Please implement the recommended traits for the enum PaddingScheme.
Clone is missing from PaddingScheme. Please fix this.
While copy may not be possible due to problems when copying RngCore--namely that an accidental copy may generate the same numbers--, clone is an important implementation which is advised by the creators of rand. With the added implementation of box-clone on Box<dyn DynDigest> and on Box<dyn RngCore>, written out in full bellow, it should be possible to derive Clone on PaddingScheme.
for DynDigest:
pubtraitDynDigest{
...
}pubtraitDynDigestBoxClone{fnclone_dyn_digest(&self) -> Box<dynDynDigest>;}impl<T>DynDigestBoxCloneforTwhereT:'static + DynDigest + Clone{fnclone_dyn_digest(&self) -> Box<dynDynDigest>{Box::new(self.clone())}}implCloneforBox<dynDynDigest>{fnclone(&self) -> Self{self.clone_dyn_digest()}}and the same for Box<dyn RngCore>:
use rand::RngCore;pubtraitRngCoreClone:RngCore{fnclone_rng_core(&self) -> Box<dynRngCoreClone>;}impl<T:'static + RngCore + Clone>RngCoreCloneforT{fnclone_rng_core(&self) -> Box<dynRngCoreClone>{Box::new(self.clone())}}implCloneforBox<dynRngCoreClone>{fnclone(&self) -> Box<dynRngCoreClone>{self.clone_rng_core()}}and switch to using Box<dyn RngCoreClone> rather than Box<dyn RngCore>.
Thanks.
Best regards,
littleTitan
Please implement the recommended traits for the enum PaddingScheme.
Clone is missing from
PaddingScheme. Please fix this.While copy may not be possible due to problems when copying RngCore--namely that an accidental copy may generate the same numbers--, clone is an important implementation which is advised by the creators of rand. With the added implementation of box-clone on
Box<dyn DynDigest>and onBox<dyn RngCore>, written out in full bellow, it should be possible to derive Clone on PaddingScheme.for
DynDigest:and the same for
Box<dyn RngCore>:and switch to using
Box<dyn RngCoreClone>rather thanBox<dyn RngCore>.Thanks.
Best regards,
littleTitan