[−][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]
#[must_use]
pub unsafe fn new(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]
#[must_use]
pub unsafe fn new_with_ptr(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 !Send for PyRawObject
impl !Sync for PyRawObject
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,