From b13ef88442e1dd48e7e9275414482eedb7cd06cb Mon Sep 17 00:00:00 2001 From: Moritz Hoffmann Date: Tue, 23 Jul 2024 16:51:47 -0400 Subject: [PATCH] Missing inlines Signed-off-by: Moritz Hoffmann --- src/impls/slice.rs | 5 +++++ src/lib.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/impls/slice.rs b/src/impls/slice.rs index 34dda42..0b3f3f4 100644 --- a/src/impls/slice.rs +++ b/src/impls/slice.rs @@ -198,6 +198,7 @@ impl> PartialEq for ReadSlice<'_, R, O> where for<'a> R::ReadItem<'a>: PartialEq, { + #[inline] fn eq(&self, other: &Self) -> bool { self.iter().eq(*other) } @@ -212,6 +213,7 @@ impl> PartialOrd for ReadSlice<'_, R, O> where for<'a> R::ReadItem<'a>: PartialOrd, { + #[inline] fn partial_cmp(&self, other: &Self) -> Option { self.iter().partial_cmp(*other) } @@ -221,6 +223,7 @@ impl> Ord for ReadSlice<'_, R, O> where for<'a> R::ReadItem<'a>: Ord, { + #[inline] fn cmp(&self, other: &Self) -> Ordering { self.iter().cmp(*other) } @@ -255,12 +258,14 @@ impl> ReadSliceInner<'_, R, O> { } /// The number of elements in this slice. + #[inline] #[must_use] pub fn len(&self) -> usize { self.end - self.start } /// Returns `true` if the slice is empty. + #[inline] #[must_use] pub fn is_empty(&self) -> bool { self.start == self.end diff --git a/src/lib.rs b/src/lib.rs index 759a508..ddc29cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -197,6 +197,7 @@ impl::Index>> FlatStack { /// /// Prefer [`Self::merge_capacity`] over this function to also pre-size the regions. #[must_use] + #[inline] pub fn with_capacity(capacity: usize) -> Self { Self { indices: S::with_capacity(capacity), @@ -206,6 +207,7 @@ impl::Index>> FlatStack { /// Returns a flat stack that can absorb the contents of `iter` without reallocation. #[must_use] + #[inline] pub fn merge_capacity<'a, I: Iterator + Clone + 'a>(stacks: I) -> Self where Self: 'a, @@ -331,6 +333,7 @@ impl<'a, R: Region, S: IndexContainer<::Index>> IntoIterator for &' type Item = R::ReadItem<'a>; type IntoIter = Iter<'a, R, S::Iter<'a>>; + #[inline] fn into_iter(self) -> Self::IntoIter { Iter { inner: self.indices.iter(), @@ -358,10 +361,12 @@ where { type Item = R::ReadItem<'a>; + #[inline] fn next(&mut self) -> Option { self.inner.next().map(|idx| self.region.index(idx)) } + #[inline] fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() }