pub struct Idr<T: RcuDroppable + Send + Sync + 'static, L: LockLevel> { /* private fields */ }Expand description
A concurrent, lock-free radix tree mapped structure primarily employed to map 32-bit IDs to objects. Optimized for massively contended reads.
Implementations§
Source§impl<T: RcuDroppable + Send + Sync + 'static, L: LockLevel> Idr<T, L>
impl<T: RcuDroppable + Send + Sync + 'static, L: LockLevel> Idr<T, L>
Sourcepub fn new(alloc_mode: IdrAllocMode) -> Self
pub fn new(alloc_mode: IdrAllocMode) -> Self
Creates a new Idr radix tree with the specified allocation mode.
Sourcepub fn new_cyclic(min_after_wrap: Option<u32>) -> Self
pub fn new_cyclic(min_after_wrap: Option<u32>) -> Self
Creates a new cyclic Idr radix tree with an optional minimum ID after wrapping.
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<T, L> !Freeze for Idr<T, L>
impl<T, L> !RefUnwindSafe for Idr<T, L>
impl<T, L> Send for Idr<T, L>
impl<T, L> Sync for Idr<T, L>where
L: Sync,
impl<T, L> Unpin for Idr<T, L>where
L: Unpin,
impl<T, L> UnsafeUnpin for Idr<T, L>
impl<T, L> UnwindSafe for Idr<T, L>where
L: 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
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