Trait ToBytes
pub trait ToBytes
Associated Types
type Bytes: NumBytes;
Required Methods
fn to_be_bytes(&self) -> Self::BytesReturn the memory representation of this number as a byte array in big-endian byte order.
Examples
use ToBytes; let bytes = to_be_bytes; assert_eq!;fn to_le_bytes(&self) -> Self::BytesReturn the memory representation of this number as a byte array in little-endian byte order.
Examples
use ToBytes; let bytes = to_le_bytes; assert_eq!;
Provided Methods
fn to_ne_bytes(&self) -> Self::BytesReturn the memory representation of this number as a byte array in native byte order.
As the target platform's native endianness is used, portable code should use
to_be_bytesorto_le_bytes, as appropriate, instead.Examples
use ToBytes; let expected = ; let expected = ; let bytes = to_ne_bytes; assert_eq!