exactsizearr: No need for default constraint on items of the ESI input
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
/// An iterator adaptor (derived from ExactSizedIterator) which has a guaranteed
|
/// An iterator adaptor (derived from ExactSizedIterator) which has a guaranteed
|
||||||
/// compile time size, allowing for collection of an iterator into a stack
|
/// compile time size, allowing for collection of an iterator into a stack
|
||||||
/// allocated array.
|
/// allocated array.
|
||||||
pub trait ExactSizedArr<I>: ExactSizeIterator<Item = I> + Sized
|
pub trait ExactSizedArr<I>: ExactSizeIterator + Sized {
|
||||||
where
|
|
||||||
I: Default,
|
|
||||||
{
|
|
||||||
fn into_array<const N: usize>(mut self) -> Result<[Self::Item; N], Self> {
|
fn into_array<const N: usize>(mut self) -> Result<[Self::Item; N], Self> {
|
||||||
if self.len() < N {
|
if self.len() < N {
|
||||||
Err(self)
|
Err(self)
|
||||||
@@ -15,9 +12,4 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Default implementation of ExactSizedArr for any ExactSizeIterator.
|
/// Default implementation of ExactSizedArr for any ExactSizeIterator.
|
||||||
impl<T, I> ExactSizedArr<T> for I
|
impl<I> ExactSizedArr<I> for I where I: ExactSizeIterator {}
|
||||||
where
|
|
||||||
T: Default + Copy + Clone,
|
|
||||||
I: ExactSizeIterator<Item = T>,
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user