pyo3::impl_::pyclass

Trait PyClassWeakRef

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

    // Provided method
    unsafe fn clear_weakrefs(&mut self, _obj: *mut PyObject, _py: Python<'_>) { ... }
}
Expand description

Represents the __weakref__ field for #[pyclass].

Required Associated Constants§

Source

const INIT: Self

Initializes a weakref instance.

Provided Methods§

Source

unsafe fn clear_weakrefs(&mut self, _obj: *mut PyObject, _py: Python<'_>)

Clears the weak references to the given object.

§Safety
  • _obj must be a pointer to the pyclass instance which contains self.
  • The GIL must be held.

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§

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