pub struct ContextPool { /* private fields */ }Expand description
Context pool for managing multiple contexts
Implementations§
Source§impl ContextPool
impl ContextPool
Sourcepub fn with_default_config(self, config: ContextConfig) -> Self
pub fn with_default_config(self, config: ContextConfig) -> Self
Set default configuration
Sourcepub fn create(&self, config: Option<ContextConfig>) -> ProbarResult<String>
pub fn create(&self, config: Option<ContextConfig>) -> ProbarResult<String>
Create a new context
Sourcepub fn acquire(&self) -> ProbarResult<String>
pub fn acquire(&self) -> ProbarResult<String>
Acquire an available context
Sourcepub fn release(&self, context_id: &str) -> ProbarResult<()>
pub fn release(&self, context_id: &str) -> ProbarResult<()>
Release a context back to the pool
Sourcepub fn close(&self, context_id: &str) -> ProbarResult<()>
pub fn close(&self, context_id: &str) -> ProbarResult<()>
Close a context
Sourcepub fn remove(&self, context_id: &str) -> ProbarResult<()>
pub fn remove(&self, context_id: &str) -> ProbarResult<()>
Remove a closed context
Sourcepub fn available_count(&self) -> usize
pub fn available_count(&self) -> usize
Get available context count
Sourcepub fn in_use_count(&self) -> usize
pub fn in_use_count(&self) -> usize
Get in-use context count
Sourcepub fn context_ids(&self) -> Vec<String>
pub fn context_ids(&self) -> Vec<String>
Get context IDs
Trait Implementations§
Source§impl Debug for ContextPool
impl Debug for ContextPool
Auto Trait Implementations§
impl Freeze for ContextPool
impl RefUnwindSafe for ContextPool
impl Send for ContextPool
impl Sync for ContextPool
impl Unpin for ContextPool
impl UnsafeUnpin for ContextPool
impl UnwindSafe for ContextPool
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