Struct rustpython_vm::object::PyAtomicRef
source · pub struct PyAtomicRef<T> { /* private fields */ }
Implementations§
source§impl<T: PyObjectPayload> PyAtomicRef<T>
impl<T: PyObjectPayload> PyAtomicRef<T>
sourcepub unsafe fn swap(&self, pyref: PyRef<T>) -> PyRef<T>
pub unsafe fn swap(&self, pyref: PyRef<T>) -> PyRef<T>
Safety
The caller is responsible to keep the returned PyRef alive until no more reference can be used via PyAtomicRef::deref()
pub fn swap_to_temporary_refs(&self, pyref: PyRef<T>, vm: &VirtualMachine)
source§impl<T: PyObjectPayload> PyAtomicRef<Option<T>>
impl<T: PyObjectPayload> PyAtomicRef<Option<T>>
pub fn deref(&self) -> Option<&Py<T>>
pub fn to_owned(&self) -> Option<PyRef<T>>
sourcepub unsafe fn swap(&self, opt_ref: Option<PyRef<T>>) -> Option<PyRef<T>>
pub unsafe fn swap(&self, opt_ref: Option<PyRef<T>>) -> Option<PyRef<T>>
Safety
The caller is responsible to keep the returned PyRef alive until no more reference can be used via PyAtomicRef::deref()
pub fn swap_to_temporary_refs( &self, opt_ref: Option<PyRef<T>>, vm: &VirtualMachine )
source§impl PyAtomicRef<PyObject>
impl PyAtomicRef<PyObject>
sourcepub unsafe fn swap(&self, obj: PyObjectRef) -> PyObjectRef
pub unsafe fn swap(&self, obj: PyObjectRef) -> PyObjectRef
Safety
The caller is responsible to keep the returned PyRef alive until no more reference can be used via PyAtomicRef::deref()
pub fn swap_to_temporary_refs(&self, obj: PyObjectRef, vm: &VirtualMachine)
source§impl PyAtomicRef<Option<PyObject>>
impl PyAtomicRef<Option<PyObject>>
pub fn deref(&self) -> Option<&PyObject>
pub fn to_owned(&self) -> Option<PyObjectRef>
sourcepub unsafe fn swap(&self, obj: Option<PyObjectRef>) -> Option<PyObjectRef>
pub unsafe fn swap(&self, obj: Option<PyObjectRef>) -> Option<PyObjectRef>
Safety
The caller is responsible to keep the returned PyRef alive until no more reference can be used via PyAtomicRef::deref()
pub fn swap_to_temporary_refs( &self, obj: Option<PyObjectRef>, vm: &VirtualMachine )
Methods from Deref<Target = Py<T>>§
sourcepub fn to_attributes(
&self,
vm: &VirtualMachine
) -> IndexMap<&'static PyStrInterned, PyObjectRef, RandomState>
pub fn to_attributes( &self, vm: &VirtualMachine ) -> IndexMap<&'static PyStrInterned, PyObjectRef, RandomState>
Take a python dictionary and convert it to attributes.
pub fn get_item_opt<K: DictKey + ?Sized>( &self, key: &K, vm: &VirtualMachine ) -> PyResult<Option<PyObjectRef>>
pub fn get_item<K: DictKey + ?Sized>( &self, key: &K, vm: &VirtualMachine ) -> PyResult
pub fn set_item<K: DictKey + ?Sized>( &self, key: &K, value: PyObjectRef, vm: &VirtualMachine ) -> PyResult<()>
pub fn del_item<K: DictKey + ?Sized>( &self, key: &K, vm: &VirtualMachine ) -> PyResult<()>
pub fn get_chain<K: DictKey + ?Sized>( &self, other: &Self, key: &K, vm: &VirtualMachine ) -> PyResult<Option<PyObjectRef>>
pub fn f_back(&self, vm: &VirtualMachine) -> Option<PyRef<Frame>>
pub fn __init_methods(&self, vm: &VirtualMachine) -> PyResult<()>
pub fn dict(&self) -> PyDictRef
pub fn get_attr<'a>( &self, attr_name: impl AsPyStr<'a>, vm: &VirtualMachine ) -> PyResult
pub fn set_attr<'a>( &self, attr_name: impl AsPyStr<'a>, attr_value: impl Into<PyObjectRef>, vm: &VirtualMachine ) -> PyResult<()>
sourcepub fn fast_issubclass(&self, cls: &impl Borrow<PyObject>) -> bool
pub fn fast_issubclass(&self, cls: &impl Borrow<PyObject>) -> bool
Determines if subclass
is actually a subclass of cls
, this doesn’t call subclasscheck,
so only use this if cls
is known to have not overridden the base subclasscheck magic
method.
pub fn iter_mro( &self ) -> impl Iterator<Item = &Py<PyType>> + DoubleEndedIterator
pub fn iter_base_chain(&self) -> impl Iterator<Item = &Py<PyType>>
pub fn extend_methods( &'static self, method_defs: &'static [PyMethodDef], ctx: &Context )
pub fn run(&self, vm: &VirtualMachine) -> PyResult<ExecutionResult>
pub fn yield_from_target(&self) -> Option<PyObjectRef>
pub fn is_internal_frame(&self) -> bool
pub fn next_external_frame(&self, vm: &VirtualMachine) -> Option<FrameRef>
pub fn build_function(&self, vm: &VirtualMachine) -> PyRef<PyNativeFunction>
pub fn build_method( &self, class: &'static Py<PyType>, vm: &VirtualMachine ) -> PyRef<PyMethodDescriptor>
pub fn upgrade(&self) -> Option<PyObjectRef>
pub fn downgrade( &self, callback: Option<PyObjectRef>, vm: &VirtualMachine ) -> PyResult<PyWeakRef<T>>
Trait Implementations§
source§impl<T: Debug> Debug for PyAtomicRef<T>
impl<T: Debug> Debug for PyAtomicRef<T>
source§impl Deref for PyAtomicRef<PyObject>
impl Deref for PyAtomicRef<PyObject>
source§impl<T: PyObjectPayload> Deref for PyAtomicRef<T>
impl<T: PyObjectPayload> Deref for PyAtomicRef<T>
source§impl From<Option<PyObjectRef>> for PyAtomicRef<Option<PyObject>>
impl From<Option<PyObjectRef>> for PyAtomicRef<Option<PyObject>>
source§fn from(obj: Option<PyObjectRef>) -> Self
fn from(obj: Option<PyObjectRef>) -> Self
Converts to this type from the input type.
source§impl<T: PyObjectPayload> From<Option<PyRef<T>>> for PyAtomicRef<Option<T>>
impl<T: PyObjectPayload> From<Option<PyRef<T>>> for PyAtomicRef<Option<T>>
source§impl From<PyObjectRef> for PyAtomicRef<PyObject>
impl From<PyObjectRef> for PyAtomicRef<PyObject>
source§fn from(obj: PyObjectRef) -> Self
fn from(obj: PyObjectRef) -> Self
Converts to this type from the input type.
source§impl<T: PyObjectPayload> From<PyRef<T>> for PyAtomicRef<T>
impl<T: PyObjectPayload> From<PyRef<T>> for PyAtomicRef<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for PyAtomicRef<T>
impl<T> !Send for PyAtomicRef<T>
impl<T> !Sync for PyAtomicRef<T>
impl<T> Unpin for PyAtomicRef<T>where T: Unpin,
impl<T> UnwindSafe for PyAtomicRef<T>where T: UnwindSafe,
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