hpke_rs::Hpke wraps its internal PRNG in a RwLock. I assume this to make its methods work with just access to a shared reference (&self) and to keep the type Send and Sync.
an alternative is to remove the internal RwLock and make Hpke's methods require a mutable reference. the end user then can wrap the whole Hpke object in a Arc<RwLock>, or Arc<Mutex>, or RefCell (if they don't need Send / Sync-ness) depending on their application requirements so it makes the API more flexible.
the internal RwLock prevents the crate from being no-std compatible so removing it clears the path towards no-std support
hpke_rs::Hpke
wraps its internal PRNG in aRwLock
. I assume this to make its methods work with just access to a shared reference (&self
) and to keep the type Send and Sync.an alternative is to remove the internal
RwLock
and makeHpke
's methods require a mutable reference. the end user then can wrap the wholeHpke
object in aArc<RwLock>
, orArc<Mutex>
, orRefCell
(if they don't needSend
/Sync
-ness) depending on their application requirements so it makes the API more flexible.the internal
RwLock
prevents the crate from being no-std compatible so removing it clears the path towards no-std support