Struct cpython::PyRustType [] [src]

pub struct PyRustType<T, B = PyObject> where T: 'static + Send, B: PythonBaseObject {
    // some fields omitted
}

A Python class that contains rust values of type T. Serves as a Python type object, and can be used to construct PyRustObject<T> instances.

Methods

impl<T, B> PyRustType<T, B> where T: 'static + Send, B: PythonBaseObject
[src]

fn create_instance(&self, py: Python, val: T, base_val: B::InitType) -> PyRustObject<T, B>

Creates a PyRustObject instance from a value.

Trait Implementations

impl<T, B> Deref for PyRustType<T, B> where T: 'static + Send, B: PythonBaseObject
[src]

type Target = PyType

The resulting type after dereferencing

fn deref(&self) -> &PyType

The method called to dereference a value

impl<T, B> ToPyObject for PyRustType<T, B> where T: 'static + Send, B: PythonBaseObject
[src]

type ObjectType = PyType

fn to_py_object(&self, py: Python) -> PyType

Converts self into a Python object.

fn into_py_object(self, _py: Python) -> PyType

Converts self into a Python object. Read more

fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where F: FnOnce(*mut PyObject) -> R

Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more

impl<T, B> PythonObject for PyRustType<T, B> where T: 'static + Send, B: PythonBaseObject
[src]

fn as_object(&self) -> &PyObject

Casts the Python object to PyObject.

fn into_object(self) -> PyObject

Casts the Python object to PyObject.

unsafe fn unchecked_downcast_from(obj: PyObject) -> Self

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

unsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a Self

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.