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

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: ```rust

[py::class]

struct MyClass { token: PyToken }

[py::methods]

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

Methods

impl PyRawObject
[src]

[src]

[src]

[src]

[src]

Type object

[src]

Return reference to object.

Trait Implementations

impl IntoPyPointer for PyRawObject
[src]

[src]

Retrieves the underlying FFI pointer. Whether pointer owned or borrowed depends on implementation. Read more

impl PyObjectWithToken for PyRawObject
[src]

[src]