Skip to main content

ElementHandle

Struct ElementHandle 

Source
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

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>

Source

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>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send> Send for ElementHandle<T>

Should be able to Send when T is Send

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.