pub enum Progress<T, P = Note> {
Update(P),
Item(T),
}Expand description
One step of a method that reports progress: an intermediate report on the way to its items, or one of the items.
P is the method’s progress type. It defaults to Note — the shape
the progress frame has always carried — so Progress<T> is the untyped
case and Progress<T, MyStep> the precise one.
use plexus_client::{Note, Progress};
enum ImportStep { Chunk { done: usize, of: usize } }
let step: Progress<u32, ImportStep> = Progress::Update(ImportStep::Chunk { done: 3, of: 10 });
let done: Progress<u32, ImportStep> = Progress::Item(42);
assert!(step.is_update());
assert_eq!(done.into_item(), Some(42));
let untyped: Progress<u32> = Progress::Update(Note::new("indexing").with_percentage(50.0));
assert!(untyped.is_update());Deliberately not Serialize/Deserialize: the two cases travel in
different frames, so there is no single wire value to encode.
Variants§
Update(P)
An intermediate report. Travels as a progress frame carrying P.
Item(T)
One of the method’s items. Travels as a data frame carrying T.
Implementations§
Source§impl<T, P> Progress<T, P>
impl<T, P> Progress<T, P>
Sourcepub fn is_update(&self) -> bool
pub fn is_update(&self) -> bool
true for Progress::Update.
Sourcepub fn is_item(&self) -> bool
pub fn is_item(&self) -> bool
true for Progress::Item.
Sourcepub fn into_update(self) -> Option<P>
pub fn into_update(self) -> Option<P>
The update, if this is one; an item is dropped.
Trait Implementations§
impl<T: Copy, P: Copy> Copy for Progress<T, P>
impl<T: Eq, P: Eq> Eq for Progress<T, P>
Source§impl<T, P> From<Progress<T, P>> for Frame<T, P>
What the server sends as Progress<T, P> arrives as Frame<T, P>:
Update ⇄ Progress, Item ⇄ Item.
impl<T, P> From<Progress<T, P>> for Frame<T, P>
What the server sends as Progress<T, P> arrives as Frame<T, P>:
Update ⇄ Progress, Item ⇄ Item.
Source§impl<T: FromClientError, P> FromClientError for Progress<T, P>
A progress item carries a client failure as its item (RETURNS-36).
impl<T: FromClientError, P> FromClientError for Progress<T, P>
A progress item carries a client failure as its item (RETURNS-36).
Source§fn from_client_error(error: ClientError) -> Self
fn from_client_error(error: ClientError) -> Self
error. It is the last item of its stream.