pub struct IdrGuard<'a, T: RcuDroppable + Send + Sync + 'static, L: LockLevel> { /* private fields */ }Expand description
An RAII guard representing exclusive writer access to an Idr.
Holding this guard serializes mutations (allocations, reservations, removals) to the radix tree while allowing concurrent lock-free reads.
Implementations§
Source§impl<'a, T: RcuDroppable + Send + Sync + 'static, L: LockLevel> IdrGuard<'a, T, L>
impl<'a, T: RcuDroppable + Send + Sync + 'static, L: LockLevel> IdrGuard<'a, T, L>
Sourcepub fn alloc<F>(&mut self, factory: F) -> Option<(u32, Arc<T>)>
pub fn alloc<F>(&mut self, factory: F) -> Option<(u32, Arc<T>)>
Allocates the next available ID by calling a factory providing the newly acquired ID.
Depending on the Idr configuration, allocation will be either linear starting
from 0, or cyclic starting from the previous cursor position.
Sourcepub fn reserve_id(&mut self, id: u32)
pub fn reserve_id(&mut self, id: u32)
Marks a specific ID as unavailable so the allocator will never return it. Does not populate the tree with an item.
Methods from Deref<Target = Idr<T, L>>§
Sourcepub fn lock(&self) -> IdrGuard<'_, T, L>
pub fn lock(&self) -> IdrGuard<'_, T, L>
Acquires the writer lock, returning an IdrGuard that provides mutating operations.
Sourcepub fn lookup(&self, id: u32, scope: &RcuReadScope) -> Option<Arc<T>>
pub fn lookup(&self, id: u32, scope: &RcuReadScope) -> Option<Arc<T>>
RCU protected lock-free lookup for readers
Sourcepub fn iter<'a>(&'a self, scope: &'a RcuReadScope) -> IdrIterator<'a, T> ⓘ
pub fn iter<'a>(&'a self, scope: &'a RcuReadScope) -> IdrIterator<'a, T> ⓘ
Returns a lock-free RCU iterator over all entries
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, L> !RefUnwindSafe for IdrGuard<'a, T, L>
impl<'a, T, L> !Send for IdrGuard<'a, T, L>
impl<'a, T, L> !UnwindSafe for IdrGuard<'a, T, L>
impl<'a, T, L> Freeze for IdrGuard<'a, T, L>
impl<'a, T, L> Sync for IdrGuard<'a, T, L>where
L: Sync,
impl<'a, T, L> Unpin for IdrGuard<'a, T, L>
impl<'a, T, L> UnsafeUnpin for IdrGuard<'a, T, L>
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]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