pub unsafe trait Shorten<T>: Sized + GenericSequence<T> {
type Shorter: Lengthen<T, Longer = Self>;
// Required methods
fn pop_back(self) -> (Self::Shorter, T);
fn pop_front(self) -> (T, Self::Shorter);
}👎Deprecated:
please upgrade to generic-array 1.x
Expand description
Defines a GenericSequence which can be shortened by removing the first or last element from it.
Additionally, any shortened sequence can be lengthened by appending or prepending an element to it.
Required Associated Types§
Required Methods§
Sourcefn pop_back(self) -> (Self::Shorter, T)
👎Deprecated: please upgrade to generic-array 1.x
fn pop_back(self) -> (Self::Shorter, T)
please upgrade to generic-array 1.x
Returns a new array without the last element, and the last element.
Example:
let a = arr![i32; 1, 2, 3, 4];
let (init, last) = a.pop_back();
assert_eq!(init, arr![i32; 1, 2, 3]);
assert_eq!(last, 4);Sourcefn pop_front(self) -> (T, Self::Shorter)
👎Deprecated: please upgrade to generic-array 1.x
fn pop_front(self) -> (T, Self::Shorter)
please upgrade to generic-array 1.x
Returns a new array without the first element, and the first element. Example:
let a = arr![i32; 1, 2, 3, 4];
let (head, tail) = a.pop_front();
assert_eq!(head, 1);
assert_eq!(tail, arr![i32; 2, 3, 4]);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.