pub struct Callback<'a> {
pub on_progress: OnProgressType<'a>,
pub on_complete: OnCompleteType<'a>,
/* private fields */
}Expand description
Methods and streams to process either on_progress or on_complete
Fields§
§on_progress: OnProgressType<'a>§on_complete: OnCompleteType<'a>Implementations§
Source§impl<'a> Callback<'a>
impl<'a> Callback<'a>
Sourcepub fn connect_on_progress_closure(
self,
closure: impl FnMut(CallbackArguments) + Send + 'a,
) -> Self
pub fn connect_on_progress_closure( self, closure: impl FnMut(CallbackArguments) + Send + 'a, ) -> Self
Attach a closure to be executed on progress
§Warning:
This closure gets executed quite often, once every ~10kB progress. If it’s too slow, some on_progress events will be dropped. If you are looking fore something that will be executed more seldom, look for Callback::connect_on_progress_closure_slow
Sourcepub fn connect_on_progress_closure_slow(
self,
closure: impl FnMut(CallbackArguments) + Send + 'a,
) -> Self
pub fn connect_on_progress_closure_slow( self, closure: impl FnMut(CallbackArguments) + Send + 'a, ) -> Self
Attach a closure to be executed on progress. This closure will be executed more seldom, around once for every MB downloaded.
Sourcepub fn connect_on_progress_closure_async<Fut: Future<Output = ()> + Send + 'a, F: Fn(CallbackArguments) -> Fut + Send + Sync + 'a>(
self,
closure: F,
) -> Self
pub fn connect_on_progress_closure_async<Fut: Future<Output = ()> + Send + 'a, F: Fn(CallbackArguments) -> Fut + Send + Sync + 'a>( self, closure: F, ) -> Self
Attach a async closure to be executed on progress
§Warning:
This closure gets executed quite often, once every ~10kB progress. If it’s too slow, some on_progress events will be dropped. If you are looking fore something that will be executed more seldom, look for Callback::connect_on_progress_closure_async_slow
Sourcepub fn connect_on_progress_closure_async_slow<Fut: Future<Output = ()> + Send + 'a, F: Fn(CallbackArguments) -> Fut + Send + Sync + 'a>(
self,
closure: F,
) -> Self
pub fn connect_on_progress_closure_async_slow<Fut: Future<Output = ()> + Send + 'a, F: Fn(CallbackArguments) -> Fut + Send + Sync + 'a>( self, closure: F, ) -> Self
Attach a async closure to be executed on progress. This closure will be executed more seldom, around once for every MB downloaded.
Sourcepub fn connect_on_progress_sender(
self,
sender: Sender<CallbackArguments>,
cancel_on_close: bool,
) -> Self
pub fn connect_on_progress_sender( self, sender: Sender<CallbackArguments>, cancel_on_close: bool, ) -> Self
Attach a bounded sender that receives messages on progress cancel_or_close indicates whether or not to cancel the download, if the receiver is closed
§Warning:
This sender gets messages quite often, once every ~10kB progress. If it’s too slow, some on_progress events will be dropped.
Sourcepub fn connect_on_progress_sender_slow(
self,
sender: Sender<CallbackArguments>,
cancel_on_close: bool,
) -> Self
pub fn connect_on_progress_sender_slow( self, sender: Sender<CallbackArguments>, cancel_on_close: bool, ) -> Self
Attach a bounded sender that receives messages on progress cancel_or_close indicates whether or not to cancel the download, if the receiver is closed
This closure will be executed more seldom, around once for every MB downloaded.