pub struct BatchResult<T, E> {
pub successes: Vec<T>,
pub failures: Vec<E>,
pub total: usize,
}Expand description
批量操作结果(支持部分成功)
Fields§
§successes: Vec<T>成功的结果
failures: Vec<E>失败的错误
total: usize总数量
Implementations§
Source§impl<T, E> BatchResult<T, E>
impl<T, E> BatchResult<T, E>
Sourcepub fn add_success(&mut self, item: T)
pub fn add_success(&mut self, item: T)
添加成功项
Sourcepub fn add_failure(&mut self, error: E)
pub fn add_failure(&mut self, error: E)
添加失败项
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
检查是否全部成功
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
获取成功率
Sourcepub fn failure_rate(&self) -> f64
pub fn failure_rate(&self) -> f64
获取失败率
Trait Implementations§
Auto Trait Implementations§
impl<T, E> Freeze for BatchResult<T, E>
impl<T, E> RefUnwindSafe for BatchResult<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for BatchResult<T, E>
impl<T, E> Sync for BatchResult<T, E>
impl<T, E> Unpin for BatchResult<T, E>
impl<T, E> UnsafeUnpin for BatchResult<T, E>
impl<T, E> UnwindSafe for BatchResult<T, E>where
T: UnwindSafe,
E: 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