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, P> Copy for Progress<T, P>
impl<T, P> Eq for Progress<T, P>
Source§impl<T, P> FromClientError for Progress<T, P>where
T: FromClientError,
A progress item carries a client failure as its item (RETURNS-36).
impl<T, P> FromClientError for Progress<T, P>where
T: FromClientError,
A progress item carries a client failure as its item (RETURNS-36).
Source§fn from_client_error(error: ClientError) -> Progress<T, P>
fn from_client_error(error: ClientError) -> Progress<T, P>
The event that stands for
error. It is the last item of its stream.impl<T, P> StructuralPartialEq for Progress<T, P>
Auto Trait Implementations§
impl<T, P> Forget for Progress<T, P>
impl<T, P> Freeze for Progress<T, P>
impl<T, P> Move for Progress<T, P>
impl<T, P> RefUnwindSafe for Progress<T, P>where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> Send for Progress<T, P>
impl<T, P> Sync for Progress<T, P>
impl<T, P> Unpin for Progress<T, P>
impl<T, P> UnsafeUnpin for Progress<T, P>where
P: UnsafeUnpin,
T: UnsafeUnpin,
impl<T, P> UnwindSafe for Progress<T, P>where
P: UnwindSafe,
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.