/// The caller must ensure that the slice outlives the pointer this
/// function returns, or else it will end up pointing to garbage.
///
+ /// The caller must also ensure that the memory the pointer (non-transitively) points to
+ /// is never written to (except inside an `UnsafeCell`) using this pointer or any pointer
+ /// derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`].
+ ///
/// Modifying the container referenced by this slice may cause its buffer
/// to be reallocated, which would also make any pointers to it invalid.
///
/// }
/// }
/// ```
+ ///
+ /// [`as_mut_ptr`]: #method.as_mut_ptr
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub const fn as_ptr(&self) -> *const T {
(1, Some(self.v.len() + 1))
}
}
+
+ #[inline]
+ fn last(mut self) -> Option<Self::Item> {
+ self.next_back()
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
(1, Some(self.v.len() + 1))
}
}
+
+ #[inline]
+ fn last(mut self) -> Option<Self::Item> {
+ self.next_back()
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
fn size_hint(&self) -> (usize, Option<usize>) {
self.inner.size_hint()
}
+
+ #[inline]
+ fn last(mut self) -> Option<Self::Item> {
+ self.next_back()
+ }
}
#[stable(feature = "slice_rsplit", since = "1.27.0")]
fn size_hint(&self) -> (usize, Option<usize>) {
self.inner.size_hint()
}
+
+ #[inline]
+ fn last(mut self) -> Option<Self::Item> {
+ self.next_back()
+ }
}
#[stable(feature = "slice_rsplit", since = "1.27.0")]
Some(snd)
}
}
+
+ #[inline]
+ fn nth_back(&mut self, n: usize) {
+ let (end, overflow) = self.v.len().overflowing_sub(n);
+ if end < self.v.len() || overflow {
+ self.v = &[];
+ None
+ } else {
+ let start = match end.checked_sub(self.chunk_size) {
+ Some(sum) => cmp::min(self.v.len(), sum),
+ None => self.v.len(),
+ };
+ let nth = &self.v[start..end];
+ self.v = &self.v[end..];
+ }
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]