pub struct FixedSizeSlotSupplier<SK> { /* private fields */ }Expand description
Implements SlotSupplier with a fixed number of slots
Implementations§
Source§impl<SK> FixedSizeSlotSupplier<SK>
impl<SK> FixedSizeSlotSupplier<SK>
Sourcepub fn new(size: usize) -> FixedSizeSlotSupplier<SK>
pub fn new(size: usize) -> FixedSizeSlotSupplier<SK>
Create a slot supplier which will only hand out at most the provided number of slots
Trait Implementations§
Source§impl<SK> SlotSupplier for FixedSizeSlotSupplier<SK>
impl<SK> SlotSupplier for FixedSizeSlotSupplier<SK>
Source§fn reserve_slot<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 dyn SlotReservationContext,
) -> Pin<Box<dyn Future<Output = SlotSupplierPermit> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FixedSizeSlotSupplier<SK>: 'async_trait,
fn reserve_slot<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 dyn SlotReservationContext,
) -> Pin<Box<dyn Future<Output = SlotSupplierPermit> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FixedSizeSlotSupplier<SK>: 'async_trait,
Block until a slot is available, then return a permit for the slot.
Source§fn try_reserve_slot(
&self,
_: &dyn SlotReservationContext,
) -> Option<SlotSupplierPermit>
fn try_reserve_slot( &self, _: &dyn SlotReservationContext, ) -> Option<SlotSupplierPermit>
Try to immediately reserve a slot, returning None if one is not available. Implementations
must not block, or risk blocking the async event loop.
Source§fn mark_slot_used(
&self,
_ctx: &dyn SlotMarkUsedContext<SlotKind = <FixedSizeSlotSupplier<SK> as SlotSupplier>::SlotKind>,
)
fn mark_slot_used( &self, _ctx: &dyn SlotMarkUsedContext<SlotKind = <FixedSizeSlotSupplier<SK> as SlotSupplier>::SlotKind>, )
Marks a slot as actually now being used. This is separate from reserving one because the
pollers need to reserve a slot before they have actually obtained work from server. Once
that task is obtained (and validated) then the slot can actually be used to work on the
task. Read more
Source§fn release_slot(
&self,
_ctx: &dyn SlotReleaseContext<SlotKind = <FixedSizeSlotSupplier<SK> as SlotSupplier>::SlotKind>,
)
fn release_slot( &self, _ctx: &dyn SlotReleaseContext<SlotKind = <FixedSizeSlotSupplier<SK> as SlotSupplier>::SlotKind>, )
Frees a slot.
Source§fn available_slots(&self) -> Option<usize>
fn available_slots(&self) -> Option<usize>
If this implementation knows how many slots are available at any moment, it should return
that here.
Source§fn slot_supplier_kind(&self) -> String
fn slot_supplier_kind(&self) -> String
Returns a human-friendly identifier describing this supplier implementation for
diagnostics and telemetry.
Auto Trait Implementations§
impl<SK> !RefUnwindSafe for FixedSizeSlotSupplier<SK>
impl<SK> !UnwindSafe for FixedSizeSlotSupplier<SK>
impl<SK> Freeze for FixedSizeSlotSupplier<SK>
impl<SK> Send for FixedSizeSlotSupplier<SK>where
SK: Send,
impl<SK> Sync for FixedSizeSlotSupplier<SK>where
SK: Sync,
impl<SK> Unpin for FixedSizeSlotSupplier<SK>where
SK: Unpin,
impl<SK> UnsafeUnpin for FixedSizeSlotSupplier<SK>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request