pub struct ConnectionPool<S> { /* private fields */ }Expand description
Connection pool managing BLE connections with priority eviction.
Implementations§
Source§impl<S> ConnectionPool<S>
impl<S> ConnectionPool<S>
Sourcepub fn max_connections(&self) -> usize
pub fn max_connections(&self) -> usize
Get the maximum pool capacity.
Sourcepub fn get(&self, addr: &TransportAddr) -> Option<&BleConnection<S>>
pub fn get(&self, addr: &TransportAddr) -> Option<&BleConnection<S>>
Look up a connection by transport address.
Sourcepub fn get_mut(&mut self, addr: &TransportAddr) -> Option<&mut BleConnection<S>>
pub fn get_mut(&mut self, addr: &TransportAddr) -> Option<&mut BleConnection<S>>
Look up a mutable connection by transport address.
Sourcepub fn contains(&self, addr: &TransportAddr) -> bool
pub fn contains(&self, addr: &TransportAddr) -> bool
Check if a connection exists for the given address.
Sourcepub fn insert(
&mut self,
addr: TransportAddr,
conn: BleConnection<S>,
) -> Result<Option<TransportAddr>, TransportError>
pub fn insert( &mut self, addr: TransportAddr, conn: BleConnection<S>, ) -> Result<Option<TransportAddr>, TransportError>
Try to insert a connection, evicting if necessary.
Returns Ok(evicted_addr) on success (with optional evicted peer),
or Err if the pool is full and the new connection cannot evict anyone.
Sourcepub fn remove(&mut self, addr: &TransportAddr) -> Option<BleConnection<S>>
pub fn remove(&mut self, addr: &TransportAddr) -> Option<BleConnection<S>>
Remove a connection by address.
Sourcepub fn addrs(&self) -> Vec<TransportAddr>
pub fn addrs(&self) -> Vec<TransportAddr>
Get all connection addresses.
Auto Trait Implementations§
impl<S> Freeze for ConnectionPool<S>
impl<S> RefUnwindSafe for ConnectionPool<S>where
S: RefUnwindSafe,
impl<S> Send for ConnectionPool<S>where
S: Send,
impl<S> Sync for ConnectionPool<S>where
S: Sync,
impl<S> Unpin for ConnectionPool<S>where
S: Unpin,
impl<S> UnsafeUnpin for ConnectionPool<S>
impl<S> UnwindSafe for ConnectionPool<S>where
S: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more