You could make your own trait and give it a blanket impl across all Digest
instances that returns Box<[u8]>
or Vec<u8>
instead of GenericArray
, but you don't need to as the authors of digest
have already created a DynDigest
trait for you:
use digest::DynDigest;
struct Crypto {
digest: Box<dyn DynDigest>,
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…