pub struct FoldOutcome<S> {
pub state: S,
pub entries_processed: usize,
pub started_at: DateTime<Utc>,
pub completed_at: DateTime<Utc>,
pub context: FoldContext,
pub metadata: Value,
}Expand description
Outcome of a fold operation.
Contains the derived state along with metadata about the fold execution.
Fields§
§state: SThe derived state
entries_processed: usizeNumber of entries processed
started_at: DateTime<Utc>When the fold started
completed_at: DateTime<Utc>When the fold completed
context: FoldContextContext used for the fold
metadata: ValueOptional metadata
Implementations§
Source§impl<S> FoldOutcome<S>
impl<S> FoldOutcome<S>
Sourcepub fn new(state: S, entries_processed: usize, context: FoldContext) -> Self
pub fn new(state: S, entries_processed: usize, context: FoldContext) -> Self
Create a new fold result with identical start and completion timestamps.
Sourcepub fn with_timing(
state: S,
entries_processed: usize,
context: FoldContext,
started_at: DateTime<Utc>,
) -> Self
pub fn with_timing( state: S, entries_processed: usize, context: FoldContext, started_at: DateTime<Utc>, ) -> Self
Create with timing information.
Sourcepub fn with_elapsed(
state: S,
entries_processed: usize,
context: FoldContext,
started_at: DateTime<Utc>,
elapsed: Duration,
) -> Self
pub fn with_elapsed( state: S, entries_processed: usize, context: FoldContext, started_at: DateTime<Utc>, elapsed: Duration, ) -> Self
Create with timing information derived from a monotonic elapsed duration.
Avoids a second Utc::now() call by computing completed_at from
started_at + elapsed.
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set metadata.
Sourcepub fn map<T, F: FnOnce(S) -> T>(self, f: F) -> FoldOutcome<T>
pub fn map<T, F: FnOnce(S) -> T>(self, f: F) -> FoldOutcome<T>
Map the state to a different type.
Trait Implementations§
Source§impl<S: Clone> Clone for FoldOutcome<S>
impl<S: Clone> Clone for FoldOutcome<S>
Source§fn clone(&self) -> FoldOutcome<S>
fn clone(&self) -> FoldOutcome<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Debug> Debug for FoldOutcome<S>
impl<S: Debug> Debug for FoldOutcome<S>
Source§impl<S: Default> Default for FoldOutcome<S>
impl<S: Default> Default for FoldOutcome<S>
Source§impl<'de, S> Deserialize<'de> for FoldOutcome<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for FoldOutcome<S>where
S: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<S> Freeze for FoldOutcome<S>where
S: Freeze,
impl<S> RefUnwindSafe for FoldOutcome<S>where
S: RefUnwindSafe,
impl<S> Send for FoldOutcome<S>where
S: Send,
impl<S> Sync for FoldOutcome<S>where
S: Sync,
impl<S> Unpin for FoldOutcome<S>where
S: Unpin,
impl<S> UnsafeUnpin for FoldOutcome<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for FoldOutcome<S>where
S: 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