pub struct PyObjectCell(/* private fields */);Expand description
A nullable object reference that can be replaced without invalidating readers.
Unlike PyAtomicRef, this cell only exposes owned reads. Concurrent stores
use the same QSBR reclamation as object slots without retaining old values
for the lifetime of a Python frame.
Implementations§
Source§impl PyObjectCell
impl PyObjectCell
Sourcepub fn load_owned(&self) -> Option<PyObjectRef>
pub fn load_owned(&self) -> Option<PyObjectRef>
Return an owned reference to the current value, or None for an empty cell.
Sourcepub fn store(&self, value: Option<PyObjectRef>) -> Option<PyObjectRef>
pub fn store(&self, value: Option<PyObjectRef>) -> Option<PyObjectRef>
Replace the stored value and return the previous reference, still owned.
Trait Implementations§
Source§impl Debug for PyObjectCell
impl Debug for PyObjectCell
Source§impl From<Option<PyObjectRef>> for PyObjectCell
impl From<Option<PyObjectRef>> for PyObjectCell
Source§fn from(value: Option<PyObjectRef>) -> Self
fn from(value: Option<PyObjectRef>) -> Self
Converts to this type from the input type.
Source§impl Traverse for PyObjectCell
impl Traverse for PyObjectCell
Source§fn traverse(&self, traverse_fn: &mut TraverseFn<'_>)
fn traverse(&self, traverse_fn: &mut TraverseFn<'_>)
impl
traverse() with caution! Following those guideline so traverse doesn’t cause memory error!: Read moreSource§fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
Extract all owned child PyObjectRefs for circular reference resolution (tp_clear).
Called just before object deallocation to break circular references.
Default implementation does nothing.
Auto Trait Implementations§
impl !Freeze for PyObjectCell
impl !RefUnwindSafe for PyObjectCell
impl !Send for PyObjectCell
impl !Sync for PyObjectCell
impl !UnwindSafe for PyObjectCell
impl Unpin for PyObjectCell
impl UnsafeUnpin for PyObjectCell
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more