Option<T> can now be ?d in a function that returns Loadable<T, E>.

This commit is contained in:
Filipe Rodrigues 2024-03-05 19:18:56 +00:00
parent 354e5db27c
commit 5adc1a41a7
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU

View File

@ -184,6 +184,15 @@ where
}
}
impl<T, E> FromResidual<Option<Infallible>> for Loadable<T, E> {
fn from_residual(residual: Option<Infallible>) -> Self {
match residual {
Some(never) => match never {},
None => Self::Empty,
}
}
}
/// Collects an iterator of `Loadable<T, E>` into a `Loadable<C, E>`,
/// where `C` is a collection of `T`s.
///