pub struct DownloadStore { /* private fields */ }Expand description
Every transfer koan knows about.
Implementations§
Source§impl DownloadStore
impl DownloadStore
pub fn new() -> Arc<Self> ⓘ
Sourcepub fn version(&self) -> u64
pub fn version(&self) -> u64
Bumped when an entry appears, settles or is forgotten — not when its byte count moves. A client redraws its list on this and reads the counters every frame regardless.
Sourcepub fn figures(&self) -> u64
pub fn figures(&self) -> u64
Bumped whenever a byte count or a rate here moved. What a client
redraws a figure on, as against version, which is the list itself
changing shape.
Sourcepub fn all(&self) -> Vec<Download>
pub fn all(&self) -> Vec<Download>
Everything, running first, then whatever settled most recently.
Sourcepub fn get(&self, id: QueueItemId) -> Option<Download>
pub fn get(&self, id: QueueItemId) -> Option<Download>
The transfer for one queue item, if there is one.
A scan, deliberately: entries are bounded by the number of download workers plus the settled tail, because a transfer only appears here when a worker picks it up. Indexing tens of rows would cost more to maintain than it saves.
Sourcepub fn phase_of(&self, id: QueueItemId) -> Option<Phase>
pub fn phase_of(&self, id: QueueItemId) -> Option<Phase>
Whether a transfer exists for this item and what it is doing, without cloning its paths and titles — what deriving a queue row needs, per row per frame.
Sourcepub fn queued(&self, download: Download)
pub fn queued(&self, download: Download)
Note that a transfer is wanted. Replaces any earlier entry for the same queue item — a track cleared and fetched again is the same row starting over, not a second one.
Sourcepub fn started(&self, id: QueueItemId, total: u64, written: Arc<ByteFeed>)
pub fn started(&self, id: QueueItemId, total: u64, written: Arc<ByteFeed>)
Bytes have started arriving, and this is how many there are in total.
Sourcepub fn finished(&self, id: QueueItemId)
pub fn finished(&self, id: QueueItemId)
It landed.
Sourcepub fn failed(&self, id: QueueItemId, reason: String)
pub fn failed(&self, id: QueueItemId, reason: String)
It did not.
Sourcepub fn clear_settled(&self)
pub fn clear_settled(&self)
Drop everything that has already settled. The running ones are not this call’s business — stopping a transfer is a different verb.
Source§impl DownloadStore
impl DownloadStore
Sourcepub fn progressed(&self)
pub fn progressed(&self)
Take a rate reading, if one is due.
Called by the downloader as bytes land, not by a timer: what knows a
transfer moved is the code moving it, and what knows it stopped is the
absence of the next call. Chunks arrive far faster than a figure needs
redrawing, so this is gated to MIN_SAMPLE_GAP before it touches the
list every client is reading.
Every running transfer is sampled, not just the one that moved: a transfer that has stalled has nothing to report by definition, and its figure decaying to zero is the one worth noticing.
Rates live here rather than in each front end because every one of them would otherwise keep its own last-reading map and get a different answer.
Trait Implementations§
Source§impl Debug for DownloadStore
impl Debug for DownloadStore
Source§impl Default for DownloadStore
impl Default for DownloadStore
Source§fn default() -> DownloadStore
fn default() -> DownloadStore
Auto Trait Implementations§
impl !Freeze for DownloadStore
impl !RefUnwindSafe for DownloadStore
impl !UnwindSafe for DownloadStore
impl Send for DownloadStore
impl Sync for DownloadStore
impl Unpin for DownloadStore
impl UnsafeUnpin for DownloadStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);