[][src]Struct asuran::repository::backend::common::sync_backend::BackendHandle

pub struct BackendHandle<B: SyncBackend> {
    channel: Sender<SyncCommand<<<B as SyncBackend>::SyncManifest as SyncManifest>::Iterator>>,
}

Wrapper Type for sync backends that converts them into async backends

Functions by moving the provided back end into a dedicated tokio task, and then sending SyncCommands to instruct that task on what to do.

Fields

channel: Sender<SyncCommand<<<B as SyncBackend>::SyncManifest as SyncManifest>::Iterator>>

Methods

impl<B> BackendHandle<B> where
    B: SyncBackend + 'static, 
[src]

pub fn new(
    queue_depth: usize,
    backend: impl FnOnce() -> B + Send + 'static
) -> Self
[src]

Constructs a new BackendHandle

Spawns a new runner thread to handle commands on.

Takes a closure that produces the required SyncBackend, in order to allow injecting non-Send backends into the spawned threads.

queue_depth should be a positive (greater than 0) integer, that represents the number of requests to hold in the processing queue at any given time.

Trait Implementations

impl<B: SyncBackend> Backend for BackendHandle<B>[src]

type Manifest = Self

type Index = Self

impl<B: SyncBackend> Clone for BackendHandle<B>[src]

impl<B: SyncBackend> Debug for BackendHandle<B>[src]

impl<B: SyncBackend> Index for BackendHandle<B>[src]

impl<B: SyncBackend> Manifest for BackendHandle<B>[src]

type Iterator = <<B as SyncBackend>::SyncManifest as SyncManifest>::Iterator

Auto Trait Implementations

impl<B> !RefUnwindSafe for BackendHandle<B>

impl<B> Send for BackendHandle<B> where
    <<B as SyncBackend>::SyncManifest as SyncManifest>::Iterator: Send,
    <B as SyncBackend>::SyncManifest: SyncManifest

impl<B> Sync for BackendHandle<B> where
    <<B as SyncBackend>::SyncManifest as SyncManifest>::Iterator: Send,
    <B as SyncBackend>::SyncManifest: SyncManifest

impl<B> Unpin for BackendHandle<B> where
    <B as SyncBackend>::SyncManifest: SyncManifest

impl<B> !UnwindSafe for BackendHandle<B>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BackendClone for T where
    T: Backend + Clone + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

impl<T> WithSubscriber for T[src]