# [−][src]Trait generic_array::sequence::Shorten

    pub unsafe trait Shorten<T>: Sized + GenericSequence<T> {
        type Shorter: Lengthen<T, Longer = Self>;
        fn pop_back(self) -> (Self::Shorter, T);
        fn pop_front(self) -> (T, Self::Shorter);
    }

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.

## Associated Types

### `type Shorter: Lengthen<T, Longer = Self>`

`GenericSequence` that has one less element than `Self`

Loading content...

## Required methods

### `fn pop_back(self) -> (Self::Shorter, T)`

Returns a new array without the last element, and the last element.

Example:

ⓘThis example is not tested

    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);

### `fn pop_front(self) -> (T, Self::Shorter)`

Returns a new array without the first element, and the first element. Example:

ⓘThis example is not tested

    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]);

Loading content...

## Implementors

### `impl<T, N: ArrayLength<T>> Shorten<T> for GenericArray<T, N> where
N: Sub<B1>,
Sub1<N>: ArrayLength<T>,
Sub1<N>: Add<B1, Output = N>,
Add1<Sub1<N>>: ArrayLength<T>,` [src]

#### `type Shorter = GenericArray<T, Sub1<N>>`

#### `fn pop_back(self) -> (Self::Shorter, T)`[src]

#### `fn pop_front(self) -> (T, Self::Shorter)`[src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)