Skip to main content

PyClassDict

Trait PyClassDict 

Source
pub trait PyClassDict: Sealed {
    const INIT: Self;

    // Provided methods
    fn clear_dict(&self, _py: Python<'_>) { ... }
    fn release_dict(&mut self, _py: Python<'_>) { ... }
    unsafe fn traverse_dict(
        &self,
        _visit: visitproc,
        _arg: *mut c_void,
    ) -> c_int { ... }
}
Expand description

Represents the __dict__ field for #[pyclass].

Required Associated Constants§

Source

const INIT: Self

Initial form of a PyObject __dict__ reference.

Provided Methods§

Source

fn clear_dict(&self, _py: Python<'_>)

Empties the dictionary of its key-value pairs.

Source

fn release_dict(&mut self, _py: Python<'_>)

Releases the owned reference to the dictionary.

Source

unsafe fn traverse_dict(&self, _visit: visitproc, _arg: *mut c_void) -> c_int

Visits the __dict__, if any, on behalf of tp_traverse.

§Safety
  • Must only be called from a tp_traverse implementation, passing that implementation’s visit and arg unchanged.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl PyClassDict for PyClassDictSlot

Source§

const INIT: Self

Source§

impl PyClassDict for PyClassDummySlot

Source§

const INIT: Self = PyClassDummySlot

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here