# Trait core::slice::SliceExt [−] [src]

    pub trait SliceExt {
        type Item;
        fn split_at(&self, mid: usize) -> (&[Self::Item], &[Self::Item]);
        fn iter(&self) -> Iter<Self::Item>;
        fn split<P>(&self, pred: P) -> Split<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn splitn<P>(&self, n: usize, pred: P) -> SplitN<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn windows(&self, size: usize) -> Windows<Self::Item>;
        fn chunks(&self, size: usize) -> Chunks<Self::Item>;
        fn get(&self, index: usize) -> Option<&Self::Item>;
        fn first(&self) -> Option<&Self::Item>;
        fn split_first(&self) -> Option<(&Self::Item, &[Self::Item])>;
        fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])>;
        fn last(&self) -> Option<&Self::Item>;
        unsafe fn get_unchecked(&self, index: usize) -> &Self::Item;
        fn as_ptr(&self) -> *const Self::Item;
        fn binary_search(&self, x: &Self::Item) -> Result<usize, usize> where Self::Item: Ord;
        fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where F: FnMut(&Self::Item) -> Ordering;
        fn len(&self) -> usize;
        fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>;
        fn iter_mut(&mut self) -> IterMut<Self::Item>;
        fn first_mut(&mut self) -> Option<&mut Self::Item>;
        fn split_first_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
        fn split_last_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
        fn last_mut(&mut self) -> Option<&mut Self::Item>;
        fn split_mut<P>(&mut self, pred: P) -> SplitMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool;
        fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<Self::Item>;
        fn swap(&mut self, a: usize, b: usize);
        fn split_at_mut(&mut self, mid: usize) -> (&mut [Self::Item], &mut [Self::Item]);
        fn reverse(&mut self);
        unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut Self::Item;
        fn as_mut_ptr(&mut self) -> *mut Self::Item;
        fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq;
        fn starts_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
        fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
        fn clone_from_slice(&mut self, &[Self::Item]) where Self::Item: Clone;

        fn is_empty(&self) -> bool { ... }
    }

Unstable (`core_slice_ext` #27701)

: stable interface provided by `impl [T]` in later crates

Extension methods for slices.

## Associated Types

### `type Item`

Unstable (`core_slice_ext` #27701)

: stable interface provided by `impl [T]` in later crates

## Required Methods

### `fn split_at(&self, mid: usize) -> (&[Self::Item], &[Self::Item])`

### `fn iter(&self) -> Iter<Self::Item>`

### `fn split<P>(&self, pred: P) -> Split<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn splitn<P>(&self, n: usize, pred: P) -> SplitN<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn windows(&self, size: usize) -> Windows<Self::Item>`

### `fn chunks(&self, size: usize) -> Chunks<Self::Item>`

### `fn get(&self, index: usize) -> Option<&Self::Item>`

### `fn first(&self) -> Option<&Self::Item>`

### `fn split_first(&self) -> Option<(&Self::Item, &[Self::Item])>`

### `fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])>`

### `fn last(&self) -> Option<&Self::Item>`

### `unsafe fn get_unchecked(&self, index: usize) -> &Self::Item`

### `fn as_ptr(&self) -> *const Self::Item`

### `fn binary_search(&self, x: &Self::Item) -> Result<usize, usize> where Self::Item: Ord`

### `fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where F: FnMut(&Self::Item) -> Ordering`

### `fn len(&self) -> usize`

### `fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>`

### `fn iter_mut(&mut self) -> IterMut<Self::Item>`

### `fn first_mut(&mut self) -> Option<&mut Self::Item>`

### `fn split_first_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>`

### `fn split_last_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>`

### `fn last_mut(&mut self) -> Option<&mut Self::Item>`

### `fn split_mut<P>(&mut self, pred: P) -> SplitMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<Self::Item, P> where P: FnMut(&Self::Item) -> bool`

### `fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<Self::Item>`

### `fn swap(&mut self, a: usize, b: usize)`

### `fn split_at_mut(&mut self, mid: usize) -> (&mut [Self::Item], &mut [Self::Item])`

### `fn reverse(&mut self)`

### `unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut Self::Item`

### `fn as_mut_ptr(&mut self) -> *mut Self::Item`

### `fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq`

### `fn starts_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq`

### `fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq`

### `fn clone_from_slice(&mut self, &[Self::Item]) where Self::Item: Clone`

## Provided Methods

### `fn is_empty(&self) -> bool`

## Implementors

- `impl<T> SliceExt for [T]`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## 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`)