pub trait ToBytes: Sealed {
type Bytes: Copy + Unpin + Send + Sync + AsRef<[u8]> + AsMut<[u8]> + SimdUint<Scalar = u8> + 'static;
// Required methods
fn to_ne_bytes(self) -> Self::Bytes;
fn to_be_bytes(self) -> Self::Bytes;
fn to_le_bytes(self) -> Self::Bytes;
fn from_ne_bytes(bytes: Self::Bytes) -> Self;
fn from_be_bytes(bytes: Self::Bytes) -> Self;
fn from_le_bytes(bytes: Self::Bytes) -> Self;
}
๐ฌThis is a nightly-only experimental API. (
portable_simd
)Expand description
Converts SIMD vectors to vectors of bytes
Required Associated Typesยง
Required Methodsยง
sourcefn to_ne_bytes(self) -> Self::Bytes
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn to_ne_bytes(self) -> Self::Bytes
portable_simd
)Returns the memory representation of this integer as a byte array in native byte order.
sourcefn to_be_bytes(self) -> Self::Bytes
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn to_be_bytes(self) -> Self::Bytes
portable_simd
)Returns the memory representation of this integer as a byte array in big-endian (network) byte order.
sourcefn to_le_bytes(self) -> Self::Bytes
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn to_le_bytes(self) -> Self::Bytes
portable_simd
)Returns the memory representation of this integer as a byte array in little-endian byte order.
sourcefn from_ne_bytes(bytes: Self::Bytes) -> Self
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn from_ne_bytes(bytes: Self::Bytes) -> Self
portable_simd
)Creates a native endian integer value from its memory representation as a byte array in native endianness.
sourcefn from_be_bytes(bytes: Self::Bytes) -> Self
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn from_be_bytes(bytes: Self::Bytes) -> Self
portable_simd
)Creates an integer value from its representation as a byte array in big endian.
sourcefn from_le_bytes(bytes: Self::Bytes) -> Self
๐ฌThis is a nightly-only experimental API. (portable_simd
)
fn from_le_bytes(bytes: Self::Bytes) -> Self
portable_simd
)Creates an integer value from its representation as a byte array in little endian.
Object Safetyยง
This trait is not object safe.