[−][src]Struct pyo3::type_object::PyRawObject
Special object that is used for python object creation.
pyo3
library automatically creates this object for class __new__
method.
Behavior is undefined if constructor of custom class does not initialze
instance of PyRawObject
with rust value with init
method.
Calling of __new__
method of base class is developer's responsibility.
Example of custom class implementation with __new__
method:
use pyo3::prelude::*; #[pyclass] struct MyClass { } #[pymethods] impl MyClass { #[new] fn new(obj: &PyRawObject) { obj.init(MyClass { }) } }
Methods
impl PyRawObject
[src]
#[must_use]
pub unsafe fn new(
py: Python,
tp_ptr: *mut PyTypeObject,
curr_ptr: *mut PyTypeObject
) -> PyResult<PyRawObject>
[src]
py: Python,
tp_ptr: *mut PyTypeObject,
curr_ptr: *mut PyTypeObject
) -> PyResult<PyRawObject>
#[must_use]
pub unsafe fn new_with_ptr(
py: Python,
ptr: *mut PyObject,
tp_ptr: *mut PyTypeObject,
curr_ptr: *mut PyTypeObject
) -> PyResult<PyRawObject>
[src]
py: Python,
ptr: *mut PyObject,
tp_ptr: *mut PyTypeObject,
curr_ptr: *mut PyTypeObject
) -> PyResult<PyRawObject>
pub fn init<T: PyTypeInfo>(&self, value: T)
[src]
pub fn type_object(&self) -> &PyType
[src]
Type object
Trait Implementations
impl IntoPyPointer for PyRawObject
[src]
impl PyNativeType for PyRawObject
[src]
impl<T: PyTypeInfo> AsRef<T> for PyRawObject
[src]
Auto Trait Implementations
impl Unpin for PyRawObject
impl !Sync for PyRawObject
impl !Send for PyRawObject
impl RefUnwindSafe for PyRawObject
impl UnwindSafe for PyRawObject
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,