[−][src]Struct access_queue::AccessQueue
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
Auto Trait Implementations
impl<T> RefUnwindSafe for AccessQueue<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for AccessQueue<T> where
T: Send,
T: Send,
impl<T> Sync for AccessQueue<T> where
T: Sync,
T: Sync,
impl<T> Unpin for AccessQueue<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for AccessQueue<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,