Skip to content

Commit

Permalink
Missing inlines
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru committed Jul 23, 2024
1 parent 712966c commit b13ef88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/impls/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl<R: Region, O: IndexContainer<R::Index>> PartialEq for ReadSlice<'_, R, O>
where
for<'a> R::ReadItem<'a>: PartialEq,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.iter().eq(*other)
}
Expand All @@ -212,6 +213,7 @@ impl<R: Region, O: IndexContainer<R::Index>> PartialOrd for ReadSlice<'_, R, O>
where
for<'a> R::ReadItem<'a>: PartialOrd,
{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.iter().partial_cmp(*other)
}
Expand All @@ -221,6 +223,7 @@ impl<R: Region, O: IndexContainer<R::Index>> Ord for ReadSlice<'_, R, O>
where
for<'a> R::ReadItem<'a>: Ord,
{
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.iter().cmp(*other)
}
Expand Down Expand Up @@ -255,12 +258,14 @@ impl<R: Region, O: IndexContainer<R::Index>> 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
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ impl<R: Region, S: IndexContainer<<R as Region>::Index>> FlatStack<R, S> {
///
/// 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),
Expand All @@ -206,6 +207,7 @@ impl<R: Region, S: IndexContainer<<R as Region>::Index>> FlatStack<R, S> {

/// Returns a flat stack that can absorb the contents of `iter` without reallocation.
#[must_use]
#[inline]
pub fn merge_capacity<'a, I: Iterator<Item = &'a Self> + Clone + 'a>(stacks: I) -> Self
where
Self: 'a,
Expand Down Expand Up @@ -331,6 +333,7 @@ impl<'a, R: Region, S: IndexContainer<<R as Region>::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(),
Expand Down Expand Up @@ -358,10 +361,12 @@ where
{
type Item = R::ReadItem<'a>;

#[inline]
fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(|idx| self.region.index(idx))
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.inner.size_hint()
}
Expand Down

0 comments on commit b13ef88

Please sign in to comment.