Struct async_fetcher::Fetcher
source · [−]pub struct Fetcher<Data> { /* private fields */ }
Expand description
An asynchronous file fetcher for clients fetching files.
The futures generated by the fetcher are compatible with single and multi-threaded runtimes, allowing you to choose between the runtime that works best for your application. A single-threaded runtime is generally recommended for fetching files, as your network connection is unlikely to be faster than a single CPU core.
Implementations
sourceimpl<Data> Fetcher<Data>
impl<Data> Fetcher<Data>
sourcepub fn cancel(self, value: Arc<AtomicBool>) -> Self
pub fn cancel(self, value: Arc<AtomicBool>) -> Self
When set, cancels any active operations.
sourcepub fn connections_per_file(self, value: u16) -> Self
pub fn connections_per_file(self, value: u16) -> Self
The number of concurrent connections to sustain per file being fetched.
Note
Defaults to 1 connection
sourcepub fn max_part_size(self, value: u32) -> Self
pub fn max_part_size(self, value: u32) -> Self
sourceimpl<Data: Send + Sync + 'static> Fetcher<Data>
impl<Data: Send + Sync + 'static> Fetcher<Data>
sourcepub fn requests_stream(
self: Arc<Self>,
inputs: impl Stream<Item = (Source, Arc<Data>)> + Unpin + Send + 'static
) -> impl Stream<Item = impl Future<Output = (Arc<Path>, Arc<Data>, Result<(), Error>)> + Send + 'static> + Send + Unpin + 'static
pub fn requests_stream(
self: Arc<Self>,
inputs: impl Stream<Item = (Source, Arc<Data>)> + Unpin + Send + 'static
) -> impl Stream<Item = impl Future<Output = (Arc<Path>, Arc<Data>, Result<(), Error>)> + Send + 'static> + Send + Unpin + 'static
Build a stream that will perform fetches when polled.
Trait Implementations
Auto Trait Implementations
impl<Data> !RefUnwindSafe for Fetcher<Data>
impl<Data> Send for Fetcher<Data> where
Data: Send + Sync,
impl<Data> Sync for Fetcher<Data> where
Data: Send + Sync,
impl<Data> Unpin for Fetcher<Data>
impl<Data> !UnwindSafe for Fetcher<Data>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more