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

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

Defines any `GenericSequence` which can be lengthened or extended by appending or prepending an element to it.

Any lengthened sequence can be shortened back to the original using `pop_front` or `pop_back`

## Associated Types

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

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

Loading content...

## Required methods

### `fn append(self, last: T) -> Self::Longer`

Returns a new array with the given element appended to the end of it.

Example:

ⓘThis example is not tested

    let a = arr![i32; 1, 2, 3];

    let b = a.append(4);

    assert_eq!(b, arr![i32; 1, 2, 3, 4]);

### `fn prepend(self, first: T) -> Self::Longer`

Returns a new array with the given element prepended to the front of it.

Example:

ⓘThis example is not tested

    let a = arr![i32; 1, 2, 3];

    let b = a.prepend(4);

    assert_eq!(b, arr![i32; 4, 1, 2, 3]);

Loading content...

## Implementors

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

#### `type Longer = GenericArray<T, Add1<N>>`

#### `fn append(self, last: T) -> Self::Longer`[src]

#### `fn prepend(self, first: T) -> Self::Longer`[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`)