Skip to main content

PyVariableClassObject

Struct PyVariableClassObject 

Source
#[doc(hidden)]
#[repr(C)]
pub struct PyVariableClassObject<T: PyClassImpl> { ob_base: <T::BaseType as PyClassBaseType>::LayoutAsBase, }
Expand description

A layout for a PyClassObject with an unknown sized base type.

Utilises PEP-697

Fields§

§ob_base: <T::BaseType as PyClassBaseType>::LayoutAsBase

Implementations§

Source§

impl<T: PyClass<Layout = Self>> PyVariableClassObject<T>

Source

unsafe fn get_contents_of_obj( obj: *mut PyObject, ) -> *mut MaybeUninit<PyClassObjectContents<T>>

Available on Py_3_12 only.
§Safety
  • obj must have the layout that the implementation is expecting
  • thread must be attached to the interpreter
Source

fn get_contents_ptr(&self) -> *mut PyClassObjectContents<T>

Available on Py_3_12 only.

Trait Implementations§

Source§

impl<T: PyClass<Layout = Self>> PyClassObjectBaseLayout<T> for PyVariableClassObject<T>

Available on Py_3_12 only.
Source§

fn ensure_threadsafe(&self)

Source§

fn check_threadsafe(&self) -> Result<(), PyBorrowError>

Source§

unsafe fn tp_dealloc(py: Python<'_>, slf: *mut PyObject)

Implementation of tp_dealloc. Read more
Source§

impl<T: PyClass<Layout = Self>> PyClassObjectLayout<T> for PyVariableClassObject<T>

Available on Py_3_12 only.
Source§

const CONTENTS_OFFSET: PyObjectOffset

Gets the offset of the contents from the start of the struct in bytes.

Source§

const BASIC_SIZE: Py_ssize_t

Used to set PyType_Spec::basicsize (docs)
Source§

const DICT_OFFSET: PyObjectOffset

Gets the offset of the dictionary from the start of the struct in bytes.
Source§

const WEAKLIST_OFFSET: PyObjectOffset

Gets the offset of the weakref list from the start of the struct in bytes.
Source§

unsafe fn contents_uninit( obj: *mut PyObject, ) -> *mut MaybeUninit<PyClassObjectContents<T>>

Obtain a pointer to the contents of an uninitialized PyObject of this type. Read more
Source§

fn get_ptr(&self) -> *mut T

Obtain a pointer to the pyclass struct.
Source§

fn ob_base(&self) -> &<T::BaseType as PyClassBaseType>::LayoutAsBase

obtain a reference to the data at the start of the PyObject.
Source§

fn contents(&self) -> &PyClassObjectContents<T>

Obtain a reference to the structure that contains the pyclass struct and associated metadata.
Source§

fn contents_mut(&mut self) -> &mut PyClassObjectContents<T>

Obtain a mutable reference to the structure that contains the pyclass struct and associated metadata.
Source§

fn borrow_checker( &self, ) -> &<T::PyClassMutability as PyClassMutability>::Checker

Source§

impl<T: PyClassImpl> PyLayout<T> for PyVariableClassObject<T>

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