For destructuring an expression into multiple constants.
The primary feature of this crate is the multiconst macro,
which destructuring an expression into multiple constants.
Example
For more examples you can look in the docs for multiconst
Basic
This example demonstrates destructuring an array (whose length is inferred) into multiple constants.
use multiconst;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
multiconst!
/// Generates all mersenne numbers (binary numbers that are all `1` bits)
/// from `start` amount of 1s up to `start + N - 1`.
const
Struct
This example demonstrates how structs that impl FieldType
can be destructured.
This example uses the FieldType derive macro
(which requires the "derive" feature)
to make it possible to destructure struct fields without
annotating their types.
use ;
assert_eq!;
assert_eq!;
multiconst!
const
Features
All these crate features are opt-in:
"derive": enables theFieldTypederive macro.
No-std support
multiconst is #![no_std], it can be used anywhere Rust can be used.
Minimum Supported Rust Version
multiconst requires Rust 1.51.0, requiring crate features to use newer language features.