Skip to main content

ManagerBuilder

Struct ManagerBuilder 

Source
pub struct ManagerBuilder<C, const N: usize> { /* private fields */ }
Expand description

Builder for Manager.

§Required

  • weight_limit — maximum total weight before eviction
  • eviction_cb — callback invoked for each evicted (key, weight) pair
  • shutdown — watch receiver that signals actors to stop

§Example

let manager = Manager::<32>::builder(limit, eviction_cb, shutdown_rx, runtime_handle)
    .capacity(10_000)
    .build();

Implementations§

Source§

impl<C, const N: usize> ManagerBuilder<C, N>

Source

pub fn capacity(self, capacity: usize) -> Self

Set the estimated per-shard capacity for preallocation.

Source

pub fn len_watermark(self, watermark: usize) -> Self

Set an optional item-count watermark.

Source

pub fn num_eviction_workers(self, n: usize) -> Self

Set the number of concurrent eviction worker tasks. Defaults to N (one per shard).

Source

pub fn build(self) -> Manager<N>

Build the Manager, spawning shard actors and eviction workers.

Must be called within a tokio runtime context.

Auto Trait Implementations§

§

impl<C, const N: usize> Freeze for ManagerBuilder<C, N>
where Arc<C>: Freeze,

§

impl<C, const N: usize> RefUnwindSafe for ManagerBuilder<C, N>
where Arc<C>: RefUnwindSafe,

§

impl<C, const N: usize> Send for ManagerBuilder<C, N>
where Arc<C>: Send,

§

impl<C, const N: usize> Sync for ManagerBuilder<C, N>
where Arc<C>: Sync,

§

impl<C, const N: usize> Unpin for ManagerBuilder<C, N>
where Arc<C>: Unpin,

§

impl<C, const N: usize> UnsafeUnpin for ManagerBuilder<C, N>
where Arc<C>: UnsafeUnpin,

§

impl<C, const N: usize> UnwindSafe for ManagerBuilder<C, N>
where Arc<C>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more