std::array::FixedSizeArray - Rust
Description: API documentation for the Rust `FixedSizeArray` trait in crate `std`.
Keywords: rust, rustlang, rust-lang, FixedSizeArray

# [−][src]Trait std::array::FixedSizeArray

    pub unsafe trait FixedSizeArray<T> {
        fn as_slice(&self) -> &[T];
        fn as_mut_slice(&mut self) -> &mut [T];
    }

🔬 This is a nightly-only experimental API. (`fixed_size_array` #27778)

Utility trait implemented only on arrays of fixed size

This trait can be used to implement other traits on fixed-size arrays without causing much metadata bloat.

The trait is marked unsafe in order to restrict implementors to fixed-size arrays. User of this trait can assume that implementors have the exact layout in memory of a fixed size array (for example, for unsafe initialization).

Note that the traits `AsRef` and `AsMut` provide similar methods for types that may not be fixed-size arrays. Implementors should prefer those traits instead.

## Required methods

###
ⓘImportant traits for &'_ [u8]

### Important traits for &'_ [u8]

`impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]`
`fn as_slice(&self) -> &[T]`

🔬 This is a nightly-only experimental API. (`fixed_size_array` #27778)

Converts the array to immutable slice

###
ⓘImportant traits for &'_ [u8]

### Important traits for &'_ [u8]

`impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]`
`fn as_mut_slice(&mut self) -> &mut [T]`

🔬 This is a nightly-only experimental API. (`fixed_size_array` #27778)

Converts the array to mutable slice

Loading content...

## Implementors

### `impl<T, A> FixedSizeArray<T> for A where
A: Unsize<[T]>,` [src]

####
ⓘImportant traits for &'_ [u8]

### Important traits for &'_ [u8]

`impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]`
`fn as_slice(&self) -> &[T]`[src]

🔬 This is a nightly-only experimental API. (`fixed_size_array` #27778)

####
ⓘImportant traits for &'_ [u8]

### Important traits for &'_ [u8]

`impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]`
`fn as_mut_slice(&mut self) -> &mut [T]`[src]

🔬 This is a nightly-only experimental API. (`fixed_size_array` #27778)
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`)