Hi, I'm new to Rust so this might be a dumb question. The following code doesn't work because elgamal_key_bytes
is 'moved' when it's passed into write()
and therefore it cannot be used again in evaluate()
. How can I fix this ownership issue without using expensive operations like clone()
?
let elgamal_key_bytes = vec![];
elgamal_key.write(elgamal_key_bytes);
let h_prev_bytes = vec![];
let h_prev = <CRH::<ConstraintF<C>, MyPoseidonParams> as TwoToOneCRH>::evaluate(&poseidon_params, &elgamal_key_bytes, &[i_prev]).unwrap();
h_prev.write(h_prev_bytes);
let i: u8 = 10;
let h_cur = <CRH::<ConstraintF<C>, MyPoseidonParams> as TwoToOneCRH>::evaluate(&poseidon_params, &elgamal_key_bytes, &[i]).unwrap();