pub struct PyType(_);
Expand description

Represents a reference to a Python type object.

Implementations

Retrieves the underlying FFI pointer associated with this Python object.

Retrieves the PyType instance for the given FFI pointer. This increments the reference count on the type object. Undefined behavior if the pointer is NULL or invalid.

Gets the name of the PyType.

Return true if self is a subtype of b.

Return true if obj is an instance of self.

Calls the type object, thus creating a new instance. This is equivalent to the Python expression: self(*args, **kwargs)

Trait Implementations

Extracts Self from the source PyObject.
Extracts Self from the source PyObject.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

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

Casts the Python object to PyObject.
Casts the Python object to PyObject.
Cast from PyObject to a concrete Python object type.
Cast from PyObject to a concrete Python object type.
Retrieves the type object for this Python object type.

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.