Docs.rs
  • generic-array-0.8.2
    • generic-array 0.8.2
    • Docs.rs crate page
    • MIT
    • Links
    • Documentation
    • Repository
    • crates.io
    • Source
    • Owners
    • fizyk20
    • novacrazy
    • Dependencies
      • nodrop ~0.1
      • typenum ^1.9
      • serde ^1.0
      • serde_json ^1.0
    • Versions
  • Go to latest version
  • Platform
    • i686-apple-darwin
    • i686-pc-windows-gnu
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-gnu
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate generic_array

  • Reexports
  • Modules
  • Macros
  • Structs
  • Traits
  • Functions

Crates

  • generic_array

Crate generic_array [−] [src]

[−] Expand description

This crate implements a structure that can be used as a generic array type.use Core Rust array types [T; N] can't be used generically with respect to N, so for example this:

struct Foo<T, N> {
    data: [T; N]
}

won't work.

generic-array exports a GenericArray<T,N> type, which lets the above be implemented as:

struct Foo<T, N: ArrayLength<T>> {
    data: GenericArray<T,N>
}

The ArrayLength<T> trait is implemented by default for unsigned integer types from typenum.

For ease of use, an arr! macro is provided - example below:

let array = arr![u32; 1, 2, 3];
assert_eq!(array[2], 3);

Reexports

pub extern crate typenum;
pub use iter::GenericArrayIter;

Modules

arr
iter

Macros

arr

Macro allowing for easy generation of Generic Arrays. Example: let test = arr![u32; 1, 2, 3];

arr_impl

Proper implementation of arr!

Structs

GenericArray

Struct representing a generic array - GenericArray<T, N> works like [T; N]

GenericArrayImplEven

Internal type used to generate a struct of appropriate size

GenericArrayImplOdd

Internal type used to generate a struct of appropriate size

Traits

ArrayLength

Trait making GenericArray work, marking types to be used as length of an array

Functions

transmute⚠

Reinterprets the bits of a value of one type as another type.

Results for typenum

No results :( Try on DuckDuckGo?

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
+
Collapse/expand 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)