pub struct BatchResult<T> {
pub successes: Vec<T>,
pub failures: Vec<(usize, String)>,
pub total: usize,
}Expand description
Result of a batch operation
Fields§
§successes: Vec<T>Successfully processed items
failures: Vec<(usize, String)>Failed items with their errors
total: usizeTotal number of items processed
Implementations§
Source§impl<T> BatchResult<T>
impl<T> BatchResult<T>
Sourcepub const fn new(
successes: Vec<T>,
failures: Vec<(usize, String)>,
total: usize,
) -> Self
pub const fn new( successes: Vec<T>, failures: Vec<(usize, String)>, total: usize, ) -> Self
Creates a new batch result
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if all items succeeded
Sourcepub fn success_count(&self) -> usize
pub fn success_count(&self) -> usize
Returns the number of successful items
Sourcepub fn failure_count(&self) -> usize
pub fn failure_count(&self) -> usize
Returns the number of failed items
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Returns the success rate as a percentage
Trait Implementations§
Source§impl<T: Clone> Clone for BatchResult<T>
impl<T: Clone> Clone for BatchResult<T>
Source§fn clone(&self) -> BatchResult<T>
fn clone(&self) -> BatchResult<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for BatchResult<T>
impl<T> RefUnwindSafe for BatchResult<T>where
T: RefUnwindSafe,
impl<T> Send for BatchResult<T>where
T: Send,
impl<T> Sync for BatchResult<T>where
T: Sync,
impl<T> Unpin for BatchResult<T>where
T: Unpin,
impl<T> UnsafeUnpin for BatchResult<T>
impl<T> UnwindSafe for BatchResult<T>where
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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