Skip to main content

CacheIoWorker

Struct CacheIoWorker 

Source
pub struct CacheIoWorker<Task, Output> { /* private fields */ }
Expand description

Generic bounded background worker over opaque backend task and output types.

Implementations§

Source§

impl<Task, Output> CacheIoWorker<Task, Output>
where Task: Send + 'static, Output: Clone + Send + 'static,

Source

pub fn new( capacity: usize, thread_name: impl Into<String>, execute: fn(Task) -> Result<Output, String>, discard: fn(Output), ) -> Result<Self, CacheIoWorkerError>

Starts a bounded worker using statically dispatched task and cleanup functions.

Source

pub fn with_nonblocking_drop(self) -> Self

Requests shutdown without joining from this handle’s destructor.

The worker owns in-flight tasks until they finish and discards queued tasks itself. Prepared submissions reject admission after shutdown.

Source

pub fn prepare( &self, key: CacheIoOperationKey, task: Task, ) -> Result<CacheIoSubmission<Task, Output>, CacheIoWorkerError>

Prepares new work or joins an exact operation already owned by the worker.

Source

pub fn retire(&self, ticket: &CacheIoTicket<Output>)

Releases exact-key ownership after task resources are safe to drop.

Trait Implementations§

Source§

impl<Task, Output> Debug for CacheIoWorker<Task, Output>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Task, Output> Drop for CacheIoWorker<Task, Output>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<Task, Output> !Freeze for CacheIoWorker<Task, Output>

§

impl<Task, Output> RefUnwindSafe for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: RefUnwindSafe, Arc<CacheIoWorkerShared<Output>>: RefUnwindSafe,

§

impl<Task, Output> Send for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: Send, Arc<CacheIoWorkerShared<Output>>: Send,

§

impl<Task, Output> Sync for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: Sync, Arc<CacheIoWorkerShared<Output>>: Sync,

§

impl<Task, Output> Unpin for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: Unpin, Arc<CacheIoWorkerShared<Output>>: Unpin,

§

impl<Task, Output> UnsafeUnpin for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: UnsafeUnpin, Arc<CacheIoWorkerShared<Output>>: UnsafeUnpin,

§

impl<Task, Output> UnwindSafe for CacheIoWorker<Task, Output>
where Sender<CacheIoWorkerRequest<Task, Output>>: UnwindSafe, Arc<CacheIoWorkerShared<Output>>: 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, 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.