#[repr(C)]pub struct SlotMeta {
pub generation: AtomicU32,
pub state: AtomicU32,
}Expand description
Metadata for a single slot.
Fields§
§generation: AtomicU32§state: AtomicU32Implementations§
Source§impl SlotMeta
impl SlotMeta
Sourcepub fn try_transition(
&self,
expected: SlotState,
new: SlotState,
) -> Result<u32, SlotState>
pub fn try_transition( &self, expected: SlotState, new: SlotState, ) -> Result<u32, SlotState>
Attempt to transition state.
Returns Ok(generation) on success, Err(actual_state) on failure.
Sourcepub fn check_generation(&self, expected: u32) -> bool
pub fn check_generation(&self, expected: u32) -> bool
Check if the slot matches the expected generation.
Sourcepub fn generation(&self) -> u32
pub fn generation(&self) -> u32
Read the current generation.
Auto Trait Implementations§
impl !Freeze for SlotMeta
impl RefUnwindSafe for SlotMeta
impl Send for SlotMeta
impl Sync for SlotMeta
impl Unpin for SlotMeta
impl UnwindSafe for SlotMeta
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