diff --git a/lib.rs b/lib.rs index 9cfe759..0fba76a 100644 --- a/lib.rs +++ b/lib.rs @@ -530,6 +530,20 @@ impl SmallVec { } } + /// Extracts a slice containing the entire vector. + /// + /// Equivalent to `&mut s[..]`. + pub fn as_slice(&self) -> &[A::Item] { + self + } + + /// Extracts a mutable slice of the entire vector. + /// + /// Equivalent to `&mut s[..]`. + pub fn as_mut_slice(&mut self) -> &mut [A::Item] { + self + } + /// Remove the element at position `index`, replacing it with the last element. /// /// This does not preserve ordering, but is O(1).