pub struct ElementHandle<T> { /* private fields */ }Expand description
A handle granting access to a single element of a bimodal_array.
An ElementHandle represents the capability to acquire a lock for a
specific element. The actual lock is held by the returned
ElementGuard, which provides mutable access to the element.
§Locking Semantics
- Calling
lockattempts to acquire element-level access. - If successful, it returns an
ElementGuardproviding&mut T. - If an
ArrayGuardis currently active, lock acquisition fails withBimodalArrayError::CouldNotAcquireElementLock.
Multiple element guards for different elements may coexist.
Element-level exclusivity is enforced through Rust’s borrowing rules,
as lock requires &mut self.
Implementations§
Source§impl<T> ElementHandle<T>
impl<T> ElementHandle<T>
Sourcepub fn lock<'a>(&'a mut self) -> Result<ElementGuard<'a, T>, BimodalArrayError>
pub fn lock<'a>(&'a mut self) -> Result<ElementGuard<'a, T>, BimodalArrayError>
Attempts to acquire mutable access to this element.
Returns an ElementGuard on success. If an ArrayGuard is
currently active, this method returns
BimodalArrayError::CouldNotAcquireElementLock.
Lock acquisition is non-blocking.
Trait Implementations§
Source§impl<T> Drop for ElementHandle<T>
impl<T> Drop for ElementHandle<T>
impl<T: Send> Send for ElementHandle<T>
Should be able to Send when T is Send
impl<T: Sync> Sync for ElementHandle<T>
Auto Trait Implementations§
impl<T> Freeze for ElementHandle<T>
impl<T> RefUnwindSafe for ElementHandle<T>where
T: RefUnwindSafe,
impl<T> Unpin for ElementHandle<T>
impl<T> UnsafeUnpin for ElementHandle<T>
impl<T> UnwindSafe for ElementHandle<T>where
T: RefUnwindSafe,
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