pub trait ToBytes { // Required method fn to_bytes(&self) -> &[u8] ⓘ; }
This trait is used in the encosure schemes as the type of input.
input
It provides the to_bytes function that turns the value provided into a &[u8].
to_bytes
&[u8]
This function turns &self into &[u8] (a slice of bytes).
&self
assert_eq!("ABC".to_bytes(), [65, 66, 67]); assert_eq!([0, 1, 2, 3].to_bytes(), [0, 1, 2, 3]);