[][src]Struct access_queue::AccessQueue

pub struct AccessQueue<T> { /* fields omitted */ }

The AccessQueue which guards access to some item.

Implementations

impl<T> AccessQueue<T>[src]

pub fn new(inner: T, count: usize) -> AccessQueue<T>[src]

Construct a new AccessQueue, which guards the inner value and allows only count concurrent accesses to occur simultaneously.

pub fn block(&self, amt: usize) -> bool[src]

Block amt accesses.

This reduces the number of concurrent accesses to the guarded item that are allowed. Until release is called, this many accesses are blocked from occurring.

This function returns true if it successfully blocked these accesses, and false if it could not. Blocking only fails if there are not as many accesses left in the queue as the caller has attempted to block.

pub fn release(&self, amt: usize)[src]

Release amt additional accesses.

This increases the number of concurrent accesses to the guarded item that are alloewd. It can be paired with block to raise and lower the limit.

pub fn access(&self) -> Access<T>[src]

Wait in the queue to access the guarded item.

pub fn skip_queue(&self) -> &T[src]

Skip the access queue and get a reference to the inner item.

This does not modify the number of simultaneous accesses allowed. It can be useful if the AccessQueue is only limited certain patterns of use on the inner item.

pub fn get_mut(&mut self) -> &mut T[src]

Get the inner item mutably.

This requires mutable access to the AccessQueue, guaranteeing that no simultaneous accesses are occurring.

Trait Implementations

impl<T: Debug> Debug for AccessQueue<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for AccessQueue<T> where
    T: RefUnwindSafe

impl<T> Send for AccessQueue<T> where
    T: Send

impl<T> Sync for AccessQueue<T> where
    T: Sync

impl<T> Unpin for AccessQueue<T> where
    T: Unpin

impl<T> UnwindSafe for AccessQueue<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.