[][src]Struct pyo3::typeob::PyRawObject

pub struct PyRawObject { /* fields omitted */ }

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:

#![feature(specialization)]

use pyo3::prelude::*;

#[pyclass]
struct MyClass { }

#[pymethods]
impl MyClass {
   #[new]
   fn __new__(obj: &PyRawObject) -> PyResult<()> {
       obj.init(||   MyClass { })
   }
}

Methods

impl PyRawObject
[src]

Type object

Trait Implementations

impl PyObjectWithGIL for PyRawObject
[src]

impl IntoPyPointer 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]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]