3 ms·
Generic type. Just like C++ or Java, really. So `ArrayVec::<T, const CAPACITY: usize>` is an ArrayVec of items of type T, with capacity CAPACITY (of type usize
by SAI_Peregrinus 5y ago
Generic type. Just like C++ or Java, really.
So `ArrayVec::<T, const CAPACITY: usize>` is an ArrayVec of items of type T, with capacity CAPACITY (of type usize, think size_t). An ArrayVec is a vector backed by a fixed-size array. Basically an array with convenience methods on it.[1]
In this case, T is `&[u8; CHUNK_LEN]` and `CAPACITY` is `NUM_INPUTS`. `&[u8; CHUNK_LEN]` is roughly equivalent to a `uint8_t* array[CHUNK_LEN]`.
So to simplify even more it's a fixed-size vector of byte arrays. The details of why it's not quite equivalent to that C code (how Rust checks the safety) are beyond the scope of this comment.
[1] https://docs.rs/arrayvec/0.7.1/arrayvec/struct.ArrayVec.html https://docs.rs/arrayvec/0.7.1/arrayvec/struct.ArrayVec.html