Skip to main content

Crate simple_endian

Crate simple_endian 

Source

Modules§

encoding_rstext_encoding_rs and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Optional encoding_rs-backed helpers.
utf8text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
UTF-8 helpers.

Structs§

BigEndian
A big-endian representation of type T that implements SpecificEndian<T>. Data stored in the struct must be converted to big-endian using ::from() or .into().
FixedCodepointStrtext_fixed and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed view of exactly N Unicode scalar values.
FixedCodepointStringtext_fixed and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A fixed-length string of exactly N Unicode scalar values (codepoints).
FixedUtf8Bytestext_fixed and text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Inline, fixed-size UTF-8 bytes.
FixedUtf8BytesReftext_fixed and text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N UTF-8 bytes.
FixedUtf8NullPaddedtext_fixed and text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
NUL-padded fixed UTF-8 bytes.
FixedUtf8SpacePaddedtext_fixed and text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Space-padded fixed UTF-8 bytes.
FixedUtf16BeNullPaddedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16BE code units interpreted as a NUL-padded string.
FixedUtf16BePackedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16BE code units interpreted as a packed string.
FixedUtf16BeSpacePaddedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16BE code units interpreted as a space-padded string.
FixedUtf16CodeUnitsEndiantext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Inline, fixed-size UTF-16 code units stored with explicit endianness.
FixedUtf16CodeUnitsRefEndiantext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N UTF-16 code units stored with explicit endianness.
FixedUtf16LeNullPaddedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16LE code units interpreted as a NUL-padded string.
FixedUtf16LePackedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16LE code units interpreted as a packed string.
FixedUtf16LeSpacePaddedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-16LE code units interpreted as a space-padded string.
FixedUtf32BeNullPaddedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32BE code units interpreted as a NUL-padded string.
FixedUtf32BePackedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32BE code units interpreted as a packed string.
FixedUtf32BeSpacePaddedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32BE code units interpreted as a space-padded string.
FixedUtf32CodeUnitsEndiantext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Inline, fixed-size UTF-32 code units stored with explicit endianness.
FixedUtf32CodeUnitsRefEndiantext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N UTF-32 code units stored with explicit endianness.
FixedUtf32LeNullPaddedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32LE code units interpreted as a NUL-padded string.
FixedUtf32LePackedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32LE code units interpreted as a packed string.
FixedUtf32LeSpacePaddedtext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Fixed UTF-32LE code units interpreted as a space-padded string.
LittleEndian
A little-endian representation of type T that implements SpecificEndian<T>. Data stored in the struct must be converted to little-endian using ::from() or .into().
Utf16StrBEtext_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Borrowed UTF-16 code units (big-endian encoded u16).
Utf16StrLEtext_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Borrowed UTF-16 code units (little-endian encoded u16).
Utf16StringBEtext_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Owned UTF-16 code units (big-endian u16).
Utf16StringLEtext_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Owned UTF-16 code units (little-endian u16).
Utf32StrBEtext_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Borrowed UTF-32 code units (big-endian encoded u32).
Utf32StrLEtext_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Borrowed UTF-32 code units (little-endian encoded u32).
Utf32StringBEtext_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Owned UTF-32 code units (big-endian u32).
Utf32StringLEtext_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Owned UTF-32 code units (little-endian u32).

Enums§

Endian
Any object implementing SpecificEndian<T> can be converted between big and little endian. Implement this trait to allow for endian conversion by this crate.
EndianValueio-core and (io-core or io-std)
Read raw bytes into a BigEndian<T>.
FixedTextErrortext_fixed and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Error returned when converting into a fixed-codepoint string fails.
FixedUtf8Errortext_fixed and text_utf8 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Errors for fixed UTF-8 byte storage.
FixedUtf16Errortext_fixed and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Errors for fixed UTF-16 code-unit storage.
FixedUtf32Errortext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Errors for fixed UTF-32 code-unit storage.
Utf16Errortext_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Errors returned when decoding UTF-16.
Utf32Errortext_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Errors returned when decoding UTF-32.

Traits§

EndianReadio-std and (io-core or io-std)
EndianReprio-core and (io-core or io-std)
EndianWriteio-std and (io-core or io-std)
FromSliceio-core and (io-core or io-std)
Trait describing types that can be read from / written to a byte slice representation. Implemented for BigEndian<T> and LittleEndian<T>.
SimpleEndian
A trait for types that do not change based on endianness.
SpecificEndian
SpecificEndianOwned
Endian conversion trait for owned / non-Copy types.

Functions§

from_bytesio-core and (io-core or io-std)
Read raw bytes and return an EndianValue<T> chosen by T::default().endian().
from_bytes_to_nativeio-core and (io-core or io-std)
Convenience: read bytes and return the host-native T directly.
read_from_sliceio-core and (io-core or io-std)
Convenience generic helpers.
read_nativeio-std and (io-core or io-std)
Read a value in its wire representation and convert it into a native type.
read_specificio-std and (io-core or io-std)
Read an endian-aware value of type E from a reader.
read_specific_dynio-std and (io-core or io-std)
Dyn-friendly adapter for read_specific.
try_read_nativeio-std and (io-core or io-std)
Like read_native, but uses TryFrom<W> for fallible conversion.
try_write_nativeio-std and (io-core or io-std)
Like write_native, but uses TryFrom<T> for fallible conversion.
try_write_native_refio-std and (io-core or io-std)
Convenience wrapper over try_write_native when you only have a reference.
write_nativeio-std and (io-core or io-std)
Convert a native value into its wire representation and write it.
write_native_refio-std and (io-core or io-std)
Convenience wrapper over write_native when you only have a reference.
write_specificio-std and (io-core or io-std)
Write an endian-aware value of type E to a writer.
write_specific_dynio-std and (io-core or io-std)
Dyn-friendly adapter for write_specific.
write_to_extendio-core and (io-core or io-std)

Type Aliases§

FixedUtf16BeCodeUnitstext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Big-endian fixed UTF-16 code units.
FixedUtf16BeCodeUnitsReftext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N UTF-16BE code units.
FixedUtf16CodeUnitsLittle-endian and text_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Host-endian fixed UTF-16 code units.
FixedUtf16CodeUnitsRefLittle-endian and text_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N host-endian UTF-16 code units.
FixedUtf16LeCodeUnitstext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Little-endian fixed UTF-16 code units.
FixedUtf16LeCodeUnitsReftext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N UTF-16LE code units.
FixedUtf16LeNullTerminatedDeprecatedtext_fixed and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Backwards-compatible name for FixedUtf16LeNullPadded.
FixedUtf32BeCodeUnitstext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
FixedUtf32BeCodeUnitsReftext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
FixedUtf32CodeUnitsLittle-endian and text_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Host-endian fixed UTF-32 code units.
FixedUtf32CodeUnitsRefLittle-endian and text_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
A borrowed reference to exactly N host-endian UTF-32 code units.
FixedUtf32LeCodeUnitstext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
FixedUtf32LeCodeUnitsReftext_fixed and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Utf16StrLittle-endian and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Utf16StringLittle-endian and text_utf16 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Utf32StrLittle-endian and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
Utf32StringLittle-endian and text_utf32 and (text_fixed or text_utf16 or text_utf32 or text_utf8)
f32be
Shorthand for BigEndian<f32>
f32le
Shorthand for LittleEndian<f32>
f64be
Shorthand for BigEndian<f64>
f64le
Shorthand for LittleEndian<f64>
i16be
Shorthand for BigEndian<i16>
i16le
Shorthand for LittleEndian<i16>
i32be
Shorthand for BigEndian<i32>
i32le
Shorthand for LittleEndian<i32>
i64be
Shorthand for BigEndian<i64>
i64le
Shorthand for LittleEndian<i64>
i128be
Shorthand for BigEndian<i128>
i128le
Shorthand for LittleEndian<i128>
isizebe
Shorthand for BigEndian<isize>
isizele
Shorthand for LittleEndian<isize>
nzi8beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroI8>
nzi8leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroI8>
nzi16beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroI16>
nzi16leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroI16>
nzi32beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroI32>
nzi32leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroI32>
nzi64beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroI64>
nzi64leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroI64>
nzi128beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroI128>
nzi128leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroI128>
nzisizebeinteger_impls and nonzero
Shorthand for BigEndian<NonZeroIsize>
nzisizeleinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroIsize>
nzu8beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroU8>
nzu8leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroU8>
nzu16beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroU16>
nzu16leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroU16>
nzu32beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroU32>
nzu32leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroU32>
nzu64beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroU64>
nzu64leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroU64>
nzu128beinteger_impls and nonzero
Shorthand for BigEndian<NonZeroU128>
nzu128leinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroU128>
nzusizebeinteger_impls and nonzero
Shorthand for BigEndian<NonZeroUsize>
nzusizeleinteger_impls and nonzero
Shorthand for LittleEndian<NonZeroUsize>
u16be
Shorthand for BigEndian<u16>
u16le
Shorthand for LittleEndian<u16>
u32be
Shorthand for BigEndian<u32>
u32le
Shorthand for LittleEndian<u32>
u64be
Shorthand for BigEndian<u64>
u64le
Shorthand for LittleEndian<u64>
u128be
Shorthand for BigEndian<u128>
u128le
Shorthand for LittleEndian<u128>
usizebe
Shorthand for BigEndian<usize>
usizele
Shorthand for LittleEndian<usize>

Derive Macros§

Endianizederive
Generate a “wire-format” struct and endian wrapper aliases.