pub trait TryCollect<C> {
type Error;
// Required method
fn try_collect(self) -> Result<C, Self::Error>;
}
Expand description
Try and collect into a collection C
.
Required Associated Types§
Required Methods§
Sourcefn try_collect(self) -> Result<C, Self::Error>
fn try_collect(self) -> Result<C, Self::Error>
Consume self and try to collect the results into C
.
This is useful in preventing the undesirable .collect().try_into()
call chain on
collections that need to be converted into a bounded type (e.g. BoundedVec
).