mirror of
https://github.com/mii443/lamport_sigs.rs.git
synced 2025-08-22 23:15:26 +00:00
Chaining iterators, no copy.
This commit is contained in:
@ -75,9 +75,7 @@ impl<T: Digest + Clone> PublicKey<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_bytes(&self) -> Vec<u8> {
|
pub fn to_bytes(&self) -> Vec<u8> {
|
||||||
let mut bytes = self.zero_values.clone();
|
self.zero_values.iter().chain(self.one_values.iter()).fold(Vec::new(), |mut acc, i| {
|
||||||
bytes.extend(self.one_values.clone());
|
|
||||||
bytes.iter().fold(Vec::new(), |mut acc, i| {
|
|
||||||
acc.append(&mut i.clone());
|
acc.append(&mut i.clone());
|
||||||
acc
|
acc
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user