pub struct SessionPool(/* private fields */);Expand description
A pool of pre-warmed Claude sessions. Cheap to clone.
Implementations§
Source§impl SessionPool
impl SessionPool
pub fn new(config: PoolConfig) -> Self
Sourcepub async fn warm(&self, n: usize) -> usize
pub async fn warm(&self, n: usize) -> usize
Spawn up to n idle sessions in parallel, within max_sessions
idle plus checked-out sessions. Returns how many were added.
Sourcepub async fn acquire(&self) -> Result<PooledSession>
pub async fn acquire(&self) -> Result<PooledSession>
Check out a session with an empty conversation and the pool’s
settings; waits while max_sessions are checked out.
Sourcepub async fn acquire_with(&self, checkout: Checkout) -> Result<PooledSession>
pub async fn acquire_with(&self, checkout: Checkout) -> Result<PooledSession>
Check out a session with an empty conversation and checkout’s
model, effort and permission mode; waits while max_sessions are
checked out.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SessionPool
impl !UnwindSafe for SessionPool
impl Forget for SessionPool
impl Freeze for SessionPool
impl Move for SessionPool
impl Send for SessionPool
impl Sync for SessionPool
impl Unpin for SessionPool
impl UnsafeUnpin for SessionPool
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