pub struct ConnectionLimit(/* private fields */);Available on crate feature
transport-http only.Expand description
Non-zero open-connection cap for HttpConfig::max_concurrent_connections,
clamped to what tokio::sync::Semaphore supports.
§Examples
use mcpls_core::ConnectionLimit;
assert!(ConnectionLimit::new(0).is_none());
assert_eq!(ConnectionLimit::new(8).unwrap().get(), 8);
assert!(ConnectionLimit::new(usize::MAX).is_some());Implementations§
Source§impl ConnectionLimit
impl ConnectionLimit
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
512: room for 100 sessions each holding a GET stream, a subscriptions/listen stream and one in-flight POST.
Sourcepub fn new(max: usize) -> Option<Self>
pub fn new(max: usize) -> Option<Self>
None for zero; larger values are clamped to the most a tokio::sync::Semaphore supports.
Sourcepub const fn get(self) -> usize
pub const fn get(self) -> usize
The wrapped limit, between 1 and the most a tokio::sync::Semaphore supports.
Trait Implementations§
Source§impl Clone for ConnectionLimit
impl Clone for ConnectionLimit
impl Copy for ConnectionLimit
Source§impl Debug for ConnectionLimit
impl Debug for ConnectionLimit
impl Eq for ConnectionLimit
Source§impl PartialEq for ConnectionLimit
impl PartialEq for ConnectionLimit
impl StructuralPartialEq for ConnectionLimit
Auto Trait Implementations§
impl Freeze for ConnectionLimit
impl RefUnwindSafe for ConnectionLimit
impl Send for ConnectionLimit
impl Sync for ConnectionLimit
impl Unpin for ConnectionLimit
impl UnsafeUnpin for ConnectionLimit
impl UnwindSafe for ConnectionLimit
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.