pub trait PyStructSequence:
StaticType
+ PyClassImpl
+ Sized
+ 'static {
type Data: PyStructSequenceData;
const __OWN_METHOD_DEFS: &'static [PyMethodDef] = _;
// Provided methods
fn from_data(data: Self::Data, vm: &VirtualMachine) -> PyTupleRef { ... }
fn slot_repr(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyStrRef> { ... }
fn __replace__(
zelf: PyRef<PyTuple>,
args: FuncArgs,
vm: &VirtualMachine,
) -> PyResult { ... }
fn __getitem__(
zelf: PyRef<PyTuple>,
needle: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult { ... }
fn extend_pyclass(ctx: &Context, class: &'static Py<PyType>) { ... }
fn __extend_py_class(ctx: &'static Context, class: &'static Py<PyType>) { ... }
fn __extend_slots(slots: &mut PyTypeSlots) { ... }
}Expand description
Trait for Python struct sequence types.
This trait is implemented by the #[pystruct_sequence] macro on the Python type struct.
It connects to the Data struct and provides Python-level functionality.
Provided Associated Constants§
const __OWN_METHOD_DEFS: &'static [PyMethodDef] = _
Required Associated Types§
Sourcetype Data: PyStructSequenceData
type Data: PyStructSequenceData
The Data struct that provides field definitions.
Provided Methods§
Sourcefn from_data(data: Self::Data, vm: &VirtualMachine) -> PyTupleRef
fn from_data(data: Self::Data, vm: &VirtualMachine) -> PyTupleRef
Convert a Data struct into a PyStructSequence instance.
fn slot_repr(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyStrRef>
fn __replace__( zelf: PyRef<PyTuple>, args: FuncArgs, vm: &VirtualMachine, ) -> PyResult
fn __getitem__( zelf: PyRef<PyTuple>, needle: PyObjectRef, vm: &VirtualMachine, ) -> PyResult
fn extend_pyclass(ctx: &Context, class: &'static Py<PyType>)
fn __extend_py_class(ctx: &'static Context, class: &'static Py<PyType>)
fn __extend_slots(slots: &mut PyTypeSlots)
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.