trdelnik_sandbox_client/temp_clone.rs
1use crate::Keypair;
2
3// @TODO remove once `Clone` is implemented for `Keypair`
4// https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
5
6/// The `TempClone` trait is used as a workaround
7/// for making non-cloneable foreign types cloneable.
8pub trait TempClone {
9 fn clone(&self) -> Self;
10}
11
12impl TempClone for Keypair {
13 fn clone(&self) -> Self {
14 Self::from_bytes(&self.to_bytes()).unwrap()
15 }
16}