Trait casper_types::bytesrepr::ToBytes
source · [−]pub trait ToBytes {
fn to_bytes(&self) -> Result<Vec<u8>, Error>;
fn serialized_length(&self) -> usize;
fn into_bytes(self) -> Result<Vec<u8>, Error>
where
Self: Sized,
{ ... }
}
Expand description
A type which can be serialized to a Vec<u8>
.
Required methods
fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.