Skip to main content

TryAll

Trait TryAll 

Source
pub trait TryAll<T, U, E: Debug> {
    // Required method
    fn try_all(
        self,
        f: impl Fn(T) -> Result<U, E>,
    ) -> Result<impl Iterator<Item = U>, E>;
}
Expand description

此 trait 用于处理返回 Result 类型的迭代器,只有当所有元素都成功时才返回 Ok,否则返回 Err。

Required Methods§

Source

fn try_all( self, f: impl Fn(T) -> Result<U, E>, ) -> Result<impl Iterator<Item = U>, E>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, U, E: Debug, I: Iterator<Item = T>> TryAll<T, U, E> for I