pub trait Constructor: PyPayload {
    type Args: FromArgs;

    // 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_method_def(method_defs: &mut Vec<PyMethodDef>) { ... }
    fn __extend_py_class(ctx: &Context, class: &'static Py<PyType>) { ... }
    fn __extend_slots(slots: &mut PyTypeSlots) { ... }
}

Required Associated Types§

Required Methods§

source

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

Provided Methods§

Implementors§

source§

impl Constructor for PyBaseException

source§

impl Constructor for PyBaseObject

source§

impl Constructor for PyBool

source§

impl Constructor for PyBoundMethod

§

type Args = PyBoundMethodNewArgs

source§

impl Constructor for PyByteArray

source§

impl Constructor for PyBytes

§

type Args = ByteInnerNewOptions

source§

impl Constructor for PyClassMethod

source§

impl Constructor for PyComplex

§

type Args = ComplexArgs

source§

impl Constructor for PyDict

source§

impl Constructor for PyEllipsis

§

type Args = ()

source§

impl Constructor for PyEnumerate

§

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

§

type Args = IntOptions

source§

impl Constructor for PyList

source§

impl Constructor for PyMap

source§

impl Constructor for PyMappingProxy

source§

impl Constructor for PyMemoryView

§

type Args = PyMemoryViewNewArgs

source§

impl Constructor for PyNamespace

source§

impl Constructor for PyNone

§

type Args = ()

source§

impl Constructor for PyNotImplemented

§

type Args = ()

source§

impl Constructor for PyProperty

source§

impl Constructor for PySet

source§

impl Constructor for PyStaticMethod

source§

impl Constructor for PyStr

§

type Args = StrArgs

source§

impl Constructor for PySuper

source§

impl Constructor for PyTuple

source§

impl Constructor for PyWeak

§

type Args = WeakNewArgs

source§

impl Constructor for PyWeakProxy

§

type Args = WeakProxyNewArgs

source§

impl Constructor for PyZip

§

type Args = (PosArgs<PyIter<PyObjectRef>>, PyZipNewArgs)

source§

impl<T> Constructor for Twhere T: Unconstructible,