diff --git a/src/impls/mirror.rs b/src/impls/mirror.rs index e240f3b..85fbbf6 100644 --- a/src/impls/mirror.rs +++ b/src/impls/mirror.rs @@ -51,13 +51,6 @@ macro_rules! implement_for { fn copy_onto(self, _target: &mut MirrorRegion) -> $index_type { self } - - #[inline(always)] - fn reserve_items(_target: &mut MirrorRegion, _items: I) - where - I: Iterator + Clone, - { - } } impl<'a> CopyOnto> for &'a $index_type { @@ -65,13 +58,6 @@ macro_rules! implement_for { fn copy_onto(self, _target: &mut MirrorRegion<$index_type>) -> $index_type { *self } - - #[inline(always)] - fn reserve_items(_target: &mut MirrorRegion<$index_type>, _items: I) - where - I: Iterator + Clone, - { - } } impl<'a> ReserveItems> for $index_type { diff --git a/src/impls/result.rs b/src/impls/result.rs index b7e9ebe..39b3df2 100644 --- a/src/impls/result.rs +++ b/src/impls/result.rs @@ -64,14 +64,6 @@ where Err(e) => Err(e.copy_onto(&mut target.errs)), } } - - fn reserve_items(_target: &mut ResultRegion, _items: I) - where - I: Iterator + Clone, - { - // CopyOnto::reserve_items(&mut target.oks, items.clone().flat_map(|r| r.ok())); - // CopyOnto::reserve_items(&mut target.errs, items.flat_map(|r| r.err())); - } } impl<'a, T: 'a, TC, E: 'a, EC> CopyOnto> for &'a Result @@ -91,17 +83,6 @@ where Err(e) => Err(e.copy_onto(&mut target.errs)), } } - - fn reserve_items(target: &mut ResultRegion, items: I) - where - I: Iterator + Clone, - { - CopyOnto::reserve_items(&mut target.oks, items.clone().flat_map(|r| r.as_ref().ok())); - CopyOnto::reserve_items( - &mut target.errs, - items.clone().flat_map(|r| r.as_ref().err()), - ); - } } impl<'a, T: 'a, TC, E: 'a, EC> ReserveItems> for &'a Result diff --git a/src/impls/slice.rs b/src/impls/slice.rs index 7d49ec2..1b76494 100644 --- a/src/impls/slice.rs +++ b/src/impls/slice.rs @@ -65,14 +65,6 @@ where .extend(self.iter().map(|t| t.copy_onto(&mut target.inner))); (start, target.slices.len()) } - - fn reserve_items(target: &mut SliceRegion, items: I) - where - I: Iterator + Clone, - { - target.slices.reserve(items.clone().map(|i| i.len()).sum()); - CopyOnto::reserve_items(&mut target.inner, items.flat_map(|i| i.iter())); - } } impl<'a, T, R: Region> ReserveItems> for &'a [T] @@ -97,13 +89,6 @@ where fn copy_onto(self, target: &mut SliceRegion) -> as Region>::Index { self.as_slice().copy_onto(target) } - - fn reserve_items(target: &mut SliceRegion, items: I) - where - I: Iterator + Clone, - { - CopyOnto::reserve_items(target, items.map(Deref::deref)) - } } impl<'a, T: 'a, R: Region> ReserveItems> for &'a Vec @@ -127,13 +112,6 @@ where fn copy_onto(self, target: &mut SliceRegion) -> as Region>::Index { self.as_slice().copy_onto(target) } - - fn reserve_items(_target: &mut SliceRegion, _items: I) - where - I: Iterator + Clone, - { - //CopyOnto::reserve_items(target, items.map(Deref::deref)) - } } impl<'a, C: Region + 'a> CopyOnto> for &'a (&'a C, &'a [C::Index]) @@ -151,19 +129,6 @@ where ); (start, target.slices.len()) } - - fn reserve_items(target: &mut SliceRegion, items: I) - where - I: Iterator + Clone, - { - target - .slices - .reserve(items.clone().map(|(_c, is)| is.len()).sum()); - CopyOnto::reserve_items( - &mut target.inner, - items.flat_map(|(c, is)| is.iter().map(|i| c.index(*i))), - ) - } } impl<'a, C: Region + 'a> ReserveItems> for &'a (C, &'a [C::Index]) diff --git a/src/impls/slice_copy.rs b/src/impls/slice_copy.rs index 13da3cc..197a42c 100644 --- a/src/impls/slice_copy.rs +++ b/src/impls/slice_copy.rs @@ -50,13 +50,6 @@ where target.slices.extend(self); (start, target.slices.len()) } - - fn reserve_items(target: &mut CopyRegion, items: I) - where - I: Iterator + Clone, - { - target.slices.reserve(items.clone().map(|i| i.len()).sum()); - } } impl ReserveItems> for &[T] { diff --git a/src/impls/string.rs b/src/impls/string.rs index 7cd2f64..12496ee 100644 --- a/src/impls/string.rs +++ b/src/impls/string.rs @@ -43,13 +43,6 @@ impl CopyOnto for &String { fn copy_onto(self, target: &mut StringRegion) -> ::Index { self.as_str().copy_onto(target) } - - fn reserve_items(target: &mut StringRegion, items: I) - where - I: Iterator + Clone, - { - CopyOnto::reserve_items(target, items.map(String::as_str)); - } } impl ReserveItems for &String { @@ -66,13 +59,6 @@ impl CopyOnto for &str { fn copy_onto(self, target: &mut StringRegion) -> ::Index { self.as_bytes().copy_onto(&mut target.inner) } - - fn reserve_items(target: &mut StringRegion, items: I) - where - I: Iterator + Clone, - { - CopyOnto::reserve_items(&mut target.inner, items.map(str::as_bytes)) - } } impl CopyOnto for &&str { @@ -80,13 +66,6 @@ impl CopyOnto for &&str { fn copy_onto(self, target: &mut StringRegion) -> ::Index { self.as_bytes().copy_onto(&mut target.inner) } - - fn reserve_items(target: &mut StringRegion, items: I) - where - I: Iterator + Clone, - { - CopyOnto::reserve_items(&mut target.inner, items.map(|s| s.as_bytes())) - } } impl ReserveItems for &str { diff --git a/src/impls/tuple.rs b/src/impls/tuple.rs index f46fab3..530b3a2 100644 --- a/src/impls/tuple.rs +++ b/src/impls/tuple.rs @@ -63,11 +63,6 @@ macro_rules! tuple_flatcontainer { let ($($name,)*) = self; ($($name.copy_onto(&mut target.[]),)*) } - - fn reserve_items(_target: &mut []<$([<$name _C>]),*>, _items: It) - where - It: Iterator + Clone { - } } #[allow(non_camel_case_types)] @@ -84,10 +79,6 @@ macro_rules! tuple_flatcontainer { let ($($name,)*) = self; ($($name.copy_onto(&mut target.[]),)*) } - fn reserve_items(_target: &mut []<$([<$name _C>]),*>, _items: It) - where - It: Iterator + Clone { - } } #[allow(non_camel_case_types)] diff --git a/src/lib.rs b/src/lib.rs index 68fa830..8cf039f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,11 +54,6 @@ pub trait CopyOnto { /// Copy self into the target container, returning an index that allows to /// look up the corresponding read item. fn copy_onto(self, target: &mut C) -> C::Index; - - /// Ensure that the region can absorb `items` without reallocation. - fn reserve_items(target: &mut C, items: I) - where - I: Iterator + Clone; } pub trait ReserveItems { @@ -258,13 +253,6 @@ mod tests { let hobbies = (&self.hobbies).copy_onto(&mut target.hobbies); (name, age, hobbies) } - - fn reserve_items(_target: &mut PersonRegion, _items: I) - where - I: Iterator + Clone, - { - todo!() - } } impl<'a> ReserveItems for &'a Person { @@ -285,13 +273,6 @@ mod tests { let hobbies = self.hobbies.copy_onto(&mut target.hobbies); (name, age, hobbies) } - - fn reserve_items(_target: &mut PersonRegion, _items: I) - where - I: Iterator + Clone, - { - todo!() - } } #[test]