Closed LWEdslev closed 7 months ago
For example if I have a pss::VerifyingKey and a function fn foo(key: &RsaPublicKey) I currenctly have to do this:
pss::VerifyingKey
fn foo(key: &RsaPublicKey)
let key: VerifyingKey<Sha256> = ....; foo(&key.clone().into()); // if we don't clone here it is moved
whereas a pretty simple implementation could make it
let key: VerifyingKey<Sha256> = ....; foo((&key).into());
the implementation could be something like:
impl<'a, D> From<&'a VerifyingKey<D>> for &'a RsaPublicKey where D: Digest, { fn from(key: &'a VerifyingKey<D>) -> Self { &key.inner } }
Use AsRef
AsRef
For example if I have a
pss::VerifyingKey
and a functionfn foo(key: &RsaPublicKey)
I currenctly have to do this:whereas a pretty simple implementation could make it
the implementation could be something like: