pub struct DownloadHub { /* private fields */ }Implementations§
Source§impl DownloadHub
impl DownloadHub
pub fn new() -> Self
Sourcepub fn mode_for(&self, backend: &TabBackend) -> Option<Mode>
pub fn mode_for(&self, backend: &TabBackend) -> Option<Mode>
Mode for backend, if already resolved for it.
Sourcepub fn set_mode(&self, backend: &TabBackend, mode: Mode)
pub fn set_mode(&self, backend: &TabBackend, mode: Mode)
Install the mode for a (new) backend. Drops router state that belonged to a previous backend.
Sourcepub fn begin_action(&self) -> u64
pub fn begin_action(&self) -> u64
Record the start of an action tool call; returns the mark used to report downloads that began during it.
Also clears the re-apply debounce: an action is exactly when a download can start, so the override is always re-sent for it.
Sourcepub fn end_action(&self)
pub fn end_action(&self)
Pair of Self::begin_action.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Force the next apply to re-send the override (another connection
that set it, such as the sidecar, just went away).
Sourcepub fn since(&self, mark: u64) -> Vec<DownloadRecord>
pub fn since(&self, mark: u64) -> Vec<DownloadRecord>
Downloads from this server’s tabs that began after mark.
pub fn list(&self) -> Vec<DownloadRecord>
Sourcepub async fn apply(&self, backend: &TabBackend, force: bool)
pub async fn apply(&self, backend: &TabBackend, force: bool)
Make sure the runtime override and event routing are in place for
backend. Debounced unless force. Never errors: failures are
logged and the launch-time prefs remain the safety net.
Sourcepub fn events_available(&self) -> bool
pub fn events_available(&self) -> bool
Whether download events can be observed on the current backend.
Sourcepub async fn wait(
&self,
id: Option<&str>,
begin_timeout: Duration,
complete_timeout: Duration,
) -> Result<Option<DownloadRecord>>
pub async fn wait( &self, id: Option<&str>, begin_timeout: Duration, complete_timeout: Duration, ) -> Result<Option<DownloadRecord>>
Wait for a download. id: that download; otherwise the newest one
no earlier id-less wait has returned (waiting up to
begin_timeout for one to begin). Then waits up to
complete_timeout for it to finish. Returns None when nothing
began; an unfinished download is returned in its current state.
Trait Implementations§
Source§impl Default for DownloadHub
impl Default for DownloadHub
Source§impl Drop for DownloadHub
impl Drop for DownloadHub
Auto Trait Implementations§
impl Forget for DownloadHub
impl Freeze for DownloadHub
impl RefUnwindSafe for DownloadHub
impl Send for DownloadHub
impl Sync for DownloadHub
impl Unpin for DownloadHub
impl UnsafeUnpin for DownloadHub
impl UnwindSafe for DownloadHub
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more