Closed jmg-duarte closed 6 months ago
Functions in traits cannot be const in the current stable version of Rust. Instead of output_size
you could write <H as OutputSizeUser>::OutputSize::USIZE
, but note that you will not be able to use this constant to create an array because of limitations of the const genercis system.
For now, I would recommend to use GenericArray
in your generic code. In future crate versions we will use hybrid-array
which should make retrieval of byte array a bit easier.
I am trying to write the following function:
But I get the following error:
Before anything else, I know
Digest
is not from this crate, but —Digest: OutputSizeUser
— which is whereoutput_size
is defined.Since the
output_size
is supposed to be known at compile time, making itconst fn
not only makes sense but would also solve this issue.Note: I know I can make
data
aVec
and solve the issue that way.