Trait Constructor

Source
pub trait Constructor: PyPayload {
    type Args: FromArgs;

    const __OWN_METHOD_DEFS: &'static [PyMethodDef] = _;

    // Required method
    fn py_new(cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult;

    // Provided methods
    fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult { ... }
    fn __extend_py_class(ctx: &Context, class: &'static Py<PyType>) { ... }
    fn __extend_slots(slots: &mut PyTypeSlots) { ... }
}

Provided Associated Constants§

Source

const __OWN_METHOD_DEFS: &'static [PyMethodDef] = _

Required Associated Types§

Required Methods§

Source

fn py_new(cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Constructor for PyBaseException

Source§

impl Constructor for PyBaseObject

Source§

impl Constructor for PyBool

Source§

impl Constructor for PyBoundMethod

Source§

type Args = PyBoundMethodNewArgs

Source§

impl Constructor for PyBytes

Source§

type Args = ByteInnerNewOptions

Source§

impl Constructor for PyClassMethod

Source§

impl Constructor for PyComplex

Source§

type Args = ComplexArgs

Source§

impl Constructor for PyEllipsis

Source§

impl Constructor for PyEnumerate

Source§

type Args = EnumerateArgs

Source§

impl Constructor for PyFilter

Source§

impl Constructor for PyFloat

Source§

impl Constructor for PyFrozenSet

Source§

impl Constructor for PyGenericAlias

Source§

impl Constructor for PyInt

Source§

type Args = IntOptions

Source§

impl Constructor for PyList

Source§

impl Constructor for PyMap

Source§

impl Constructor for PyMappingProxy

Source§

impl Constructor for PyMemoryView

Source§

type Args = PyMemoryViewNewArgs

Source§

impl Constructor for PyNone

Source§

impl Constructor for PyNotImplemented

Source§

impl Constructor for PyProperty

Source§

impl Constructor for PyStaticMethod

Source§

impl Constructor for PyStr

Source§

type Args = StrArgs

Source§

impl Constructor for PySuper

Source§

impl Constructor for PyTuple

Source§

impl Constructor for PyType

Source§

impl Constructor for PyWeak

Source§

type Args = WeakNewArgs

Source§

impl Constructor for PyWeakProxy

Source§

type Args = WeakProxyNewArgs

Source§

impl Constructor for PyZip

Source§

type Args = (PosArgs<PyIter>, PyZipNewArgs)

Source§

impl<T> Constructor for T