pub struct PythonObjectSpace { /* private fields */ }Expand description
Python class and instance policy using shared property mechanics.
Implementations§
Source§impl PythonObjectSpace
impl PythonObjectSpace
Sourcepub fn define_class(
&mut self,
id: u64,
name: impl Into<String>,
bases: Vec<u64>,
) -> Result<(), ClassError>
pub fn define_class( &mut self, id: u64, name: impl Into<String>, bases: Vec<u64>, ) -> Result<(), ClassError>
Declare a class and compute its C3 MRO.
Sourcepub fn instantiate(
&mut self,
object: u64,
class: u64,
) -> Result<(), AttributeError>
pub fn instantiate( &mut self, object: u64, class: u64, ) -> Result<(), AttributeError>
Allocate an instance of a known class.
Sourcepub fn class(&self, id: u64) -> Option<&PythonClass>
pub fn class(&self, id: u64) -> Option<&PythonClass>
Return a declared class.
Sourcepub fn define_value(
&mut self,
owner: u64,
key: impl Into<String>,
value: PythonObjectValue,
)
pub fn define_value( &mut self, owner: u64, key: impl Into<String>, value: PythonObjectValue, )
Define a plain instance or class attribute.
Sourcepub fn define_descriptor(
&mut self,
class: u64,
key: impl Into<String>,
getter: DescriptorHook,
data: bool,
)
pub fn define_descriptor( &mut self, class: u64, key: impl Into<String>, getter: DescriptorHook, data: bool, )
Define a Python data or non-data descriptor on a class.
Sourcepub fn get(
&mut self,
object: u64,
key: &str,
) -> Result<PythonObjectValue, AttributeError>
pub fn get( &mut self, object: u64, key: &str, ) -> Result<PythonObjectValue, AttributeError>
Resolve an attribute with Python data-descriptor, instance, non-data, and class-value precedence.
Sourcepub fn get_super(
&mut self,
current: u64,
object: u64,
key: &str,
) -> Result<PythonObjectValue, AttributeError>
pub fn get_super( &mut self, current: u64, object: u64, key: &str, ) -> Result<PythonObjectValue, AttributeError>
Resolve as super(Current, object), starting after Current in the MRO.
Trait Implementations§
Source§impl Default for PythonObjectSpace
impl Default for PythonObjectSpace
Source§fn default() -> PythonObjectSpace
fn default() -> PythonObjectSpace
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PythonObjectSpace
impl RefUnwindSafe for PythonObjectSpace
impl Send for PythonObjectSpace
impl Sync for PythonObjectSpace
impl Unpin for PythonObjectSpace
impl UnsafeUnpin for PythonObjectSpace
impl UnwindSafe for PythonObjectSpace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more