pub struct Pool<T: 'static + Sync + Send, S: Sync> { /* private fields */ }Implementations§
Source§impl<T: 'static + Sync + Send, S: Sync> Pool<T, S>
impl<T: 'static + Sync + Send, S: Sync> Pool<T, S>
Sourcepub fn new<'a>(
max: usize,
state: S,
transform: impl Fn(&mut S, &mut PoolTransformer<'_, T>) + Sync + Send + 'static,
) -> Self
pub fn new<'a>( max: usize, state: S, transform: impl Fn(&mut S, &mut PoolTransformer<'_, T>) + Sync + Send + 'static, ) -> Self
use apool::Pool;
let pool = Pool::<usize, usize>::new(
4,
0,
|state, transformer| {
let i = *state;
*state += 1;
transformer.spawn(async move {
i
});
},
);pub async fn get(&self) -> PoolGuard<'_, T, S>
Auto Trait Implementations§
impl<T, S> !Freeze for Pool<T, S>
impl<T, S> !RefUnwindSafe for Pool<T, S>
impl<T, S> Send for Pool<T, S>where
S: Send,
impl<T, S> Sync for Pool<T, S>where
S: Send,
impl<T, S> Unpin for Pool<T, S>where
S: Unpin,
impl<T, S> !UnwindSafe for Pool<T, S>
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