pub struct Capacity(/* private fields */);Expand description
One short synchronous critical section covers duplicate checks, capacity checks and reservation. No I/O or awaits occur while holding this lock.
Implementations§
Source§impl Capacity
impl Capacity
pub fn new(limit: Option<NonZeroUsize>) -> Self
pub fn try_reserve(&self, agent_id: AgentId) -> HostResult<ResidentPermit>
Sourcepub fn set_limit(&self, limit: Option<NonZeroUsize>) -> HostResult<()>
pub fn set_limit(&self, limit: Option<NonZeroUsize>) -> HostResult<()>
Lowering a limit blocks new reservations; it never evicts existing Agents.
pub fn snapshot(&self) -> HostResult<CapacitySnapshot>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Capacity
impl Freeze for Capacity
impl Move for Capacity
impl RefUnwindSafe for Capacity
impl Send for Capacity
impl Sync for Capacity
impl Unpin for Capacity
impl UnsafeUnpin for Capacitywhere
*const ArcInner<Mutex<State>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<State>>>: UnsafeUnpin,
impl UnwindSafe for Capacity
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