Simplify [T; N]::try_map signature
People keep making fun of this signature for being so gnarly. Associated type bounds lend it a much simpler scribbling. ChangeOutputType can also come along for the ride.
This commit is contained in:
@@ -533,11 +533,9 @@ impl<T, const N: usize> [T; N] {
|
||||
/// assert_eq!(c, Some(a));
|
||||
/// ```
|
||||
#[unstable(feature = "array_try_map", issue = "79711")]
|
||||
pub fn try_map<F, R>(self, f: F) -> ChangeOutputType<R, [R::Output; N]>
|
||||
pub fn try_map<R>(self, f: impl FnMut(T) -> R) -> ChangeOutputType<R, [R::Output; N]>
|
||||
where
|
||||
F: FnMut(T) -> R,
|
||||
R: Try,
|
||||
R::Residual: Residual<[R::Output; N]>,
|
||||
R: Try<Residual: Residual<[R::Output; N]>>,
|
||||
{
|
||||
drain_array_with(self, |iter| try_from_trusted_iterator(iter.map(f)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user