diff --git a/src/lib.rs b/src/lib.rs index b2d8902..b67556b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -164,18 +164,17 @@ impl<'a, T: ToOwned + ?Sized> IntoOwned<'a> for &'a T { feature = "serde", serde(bound = " R: Serialize + for<'a> Deserialize<'a>, - R::Index: Serialize + for<'a> Deserialize<'a>, S: Serialize + for<'a> Deserialize<'a>, ") )] -pub struct FlatStack = Vec<::Index>> { +pub struct FlatStack::Index>> { /// The indices, which we use to lookup items in the region. indices: S, /// A region to index into. region: R, } -impl::Index>> Default for FlatStack { +impl Default for FlatStack { #[inline] fn default() -> Self { Self { @@ -319,8 +318,10 @@ impl FlatStack { } } -impl, S: OffsetContainer<::Index>> Extend - for FlatStack +impl Extend for FlatStack +where + R: Region + Push, + S: OffsetContainer<::Index>, { fn extend>(&mut self, iter: I) { let iter = iter.into_iter(); @@ -395,7 +396,11 @@ where } } -impl, T> FromIterator for FlatStack { +impl FromIterator for FlatStack +where + R: Region + Push, + S: OffsetContainer<::Index>, +{ fn from_iter>(iter: I) -> Self { let iter = iter.into_iter(); let mut c = Self::with_capacity(iter.size_hint().0); @@ -404,7 +409,7 @@ impl, T> FromIterator for FlatStack { } } -impl Clone for FlatStack { +impl Clone for FlatStack { fn clone(&self) -> Self { Self { region: self.region.clone(), @@ -496,7 +501,7 @@ mod tests { // Make sure that types are debug, even if we don't use this in the test. for<'a> R::ReadItem<'a>: Debug, { - let mut c = FlatStack::default(); + let mut c = FlatStack::<_>::default(); c.copy(t); let mut cc = c.clone();