Crate hybrid_array

source ·
Expand description

RustCrypto: Hybrid Const Generic / Typenum Arrays

crate Docs Build Status Apache2/MIT licensed Rust Version Project Chat

Hybrid array type combining const generics with the expressiveness of typenum-based constraints, providing an alternative to generic-array and a incremental transition path to const generics.

Documentation

About

This crate uses typenum to enable the following features which aren’t yet possible with the stable implementation of const generics:

Internally the crate is built on const generics and provides traits which make it possible to convert between const generic types and typenum types.

Features

This crate exposes the following feature flags. The default is NO features.

  • zeroize - Implements Zeroize for Array<T: Zeroize, U>

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Re-exports

Modules

  • Type aliases for many constants.

Structs

  • Hybrid typenum-based and const generic array type.

Traits

  • Array operations which are const generic over a given array size.
  • Trait which associates a usize size and ArrayType with a typenum-provided Unsigned integer.
  • Associates an ArraySize with a given type.
  • Construct an array type from the given function.
  • Slice operations which don’t have access to a const generic array size.

Functions

  • Splits the shared slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.
  • Splits the exclusive slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

Type Aliases

  • Type alias for Array which is const generic around a size N, ala [T; N].