mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
cdfba84b4e
Depends on D15315 Differential Revision: https://phabricator.services.mozilla.com/D15316 --HG-- rename : third_party/rust/block-buffer/src/paddings.rs => third_party/rust/block-buffer-0.3.3/src/paddings.rs rename : third_party/rust/byte-tools/src/read_single.rs => third_party/rust/byte-tools-0.2.0/src/read_single.rs rename : third_party/rust/byte-tools/src/read_slice.rs => third_party/rust/byte-tools-0.2.0/src/read_slice.rs rename : third_party/rust/byte-tools/src/write_single.rs => third_party/rust/byte-tools-0.2.0/src/write_single.rs rename : third_party/rust/byte-tools/src/write_slice.rs => third_party/rust/byte-tools-0.2.0/src/write_slice.rs rename : third_party/rust/sha2/tests/data/sha224/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha224/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha224/test2.input.bin rename : third_party/rust/sha2/tests/data/sha224/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha224/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha224/test3.input.bin rename : third_party/rust/sha2/tests/data/sha224/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha224/test3.output.bin rename : third_party/rust/sha2/tests/data/sha256/one_million_a.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/one_million_a.output.bin rename : third_party/rust/sha2/tests/data/sha256/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/test2.input.bin rename : third_party/rust/sha2/tests/data/sha256/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/test3.input.bin rename : third_party/rust/sha2/tests/data/sha256/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha256/test3.output.bin rename : third_party/rust/sha2/tests/data/sha384/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha384/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha384/test2.input.bin rename : third_party/rust/sha2/tests/data/sha384/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha384/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha384/test3.input.bin rename : third_party/rust/sha2/tests/data/sha384/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha384/test3.output.bin rename : third_party/rust/sha2/tests/data/sha512/one_million_a.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/one_million_a.output.bin rename : third_party/rust/sha2/tests/data/sha512/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/test2.input.bin rename : third_party/rust/sha2/tests/data/sha512/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/test3.input.bin rename : third_party/rust/sha2/tests/data/sha512/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512/test3.output.bin rename : third_party/rust/sha2/tests/data/sha512_224/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_224/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_224/test2.input.bin rename : third_party/rust/sha2/tests/data/sha512_224/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_224/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_224/test3.input.bin rename : third_party/rust/sha2/tests/data/sha512_224/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_224/test3.output.bin rename : third_party/rust/sha2/tests/data/sha512_256/test1.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_256/test1.output.bin rename : third_party/rust/sha2/tests/data/sha224/test2.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_256/test2.input.bin rename : third_party/rust/sha2/tests/data/sha512_256/test2.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_256/test2.output.bin rename : third_party/rust/sha2/tests/data/sha224/test3.input.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_256/test3.input.bin rename : third_party/rust/sha2/tests/data/sha512_256/test3.output.bin => third_party/rust/sha2-0.7.1/tests/data/sha512_256/test3.output.bin rename : third_party/rust/sha2/tests/data/sha256/one_million_a.output.bin => third_party/rust/sha2/tests/data/sha256_one_million_a.bin rename : third_party/rust/sha2/tests/data/sha512/one_million_a.output.bin => third_party/rust/sha2/tests/data/sha512_one_million_a.bin extra : moz-landing-system : lando
1.2 KiB
1.2 KiB
generic-array
This crate implements generic array types for Rust.
Usage
The Rust arrays [T; N]
are problematic in that they can't be used generically with respect to N
, so for example this won't work:
struct Foo<N> {
data: [i32; N]
}
generic-array defines a new trait ArrayLength<T>
and a struct GenericArray<T, N: ArrayLength<T>>
, which let the above be implemented as:
struct Foo<N: ArrayLength<i32>> {
data: GenericArray<i32, N>
}
To actually define a type implementing ArrayLength
, you can use unsigned integer types defined in typenum crate - for example, GenericArray<T, U5>
would work almost like [T; 5]
:)
In version 0.1.1 an arr!
macro was introduced, allowing for creation of arrays as shown below:
let array = arr![u32; 1, 2, 3];
assert_eq!(array[2], 3);