pub struct Guard<T> { /* private fields */ }Expand description
A handle to a value from the pool
When the Guard is dropped, the value is returned to the pool
§Examples
use tub::{Pool, Guard};
#[tokio::main]
async fn main() {
// Create a pool of u32 values
let pool: Pool<u32> = Pool::from_default(10);
// Get a value from the pool
let mut value: Guard<u32> = pool.acquire().await;
// Return the value to the pool
drop(value);
}Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Guard<T>where
T: Freeze,
impl<T> RefUnwindSafe for Guard<T>where
T: RefUnwindSafe,
impl<T> Send for Guard<T>where
T: Send,
impl<T> Sync for Guard<T>
impl<T> Unpin for Guard<T>where
T: Unpin,
impl<T> UnwindSafe for Guard<T>where
T: 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