Enum byteorder::LittleEndian [−][src]
pub enum LittleEndian {}
Defines little-endian serialization.
Note that this type has no value constructor. It is used purely at the type level.
Examples
Write and read u32
numbers in little endian order:
use byteorder::{ByteOrder, LittleEndian}; let mut buf = [0; 4]; LittleEndian::write_u32(&mut buf, 1_000_000); assert_eq!(1_000_000, LittleEndian::read_u32(&buf));
Trait Implementations
impl ByteOrder for LittleEndian
[src][+]
fn read_u16(buf: &[u8]) -> u16
[src][−]
Reads an unsigned 16 bit integer from buf
. Read more
fn read_u32(buf: &[u8]) -> u32
[src][−]
Reads an unsigned 32 bit integer from buf
. Read more
fn read_u64(buf: &[u8]) -> u64
[src][−]
Reads an unsigned 64 bit integer from buf
. Read more
fn read_u128(buf: &[u8]) -> u128
[src][−]
Reads an unsigned 128 bit integer from buf
. Read more
fn read_uint(buf: &[u8], nbytes: usize) -> u64
[src][−]
Reads an unsigned n-bytes integer from buf
. Read more
fn read_uint128(buf: &[u8], nbytes: usize) -> u128
[src][−]
Reads an unsigned n-bytes integer from buf
. Read more
fn write_u16(buf: &mut [u8], n: u16)
[src][−]
Writes an unsigned 16 bit integer n
to buf
. Read more
fn write_u32(buf: &mut [u8], n: u32)
[src][−]
Writes an unsigned 32 bit integer n
to buf
. Read more
fn write_u64(buf: &mut [u8], n: u64)
[src][−]
Writes an unsigned 64 bit integer n
to buf
. Read more
fn write_u128(buf: &mut [u8], n: u128)
[src][−]
Writes an unsigned 128 bit integer n
to buf
. Read more
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
[src][−]
Writes an unsigned integer n
to buf
using only nbytes
. Read more
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize)
[src][−]
Writes an unsigned integer n
to buf
using only nbytes
. Read more
fn read_u16_into(src: &[u8], dst: &mut [u16])
[src][−]
Reads unsigned 16 bit integers from src
into dst
. Read more
fn read_u32_into(src: &[u8], dst: &mut [u32])
[src][−]
Reads unsigned 32 bit integers from src
into dst
. Read more
fn read_u64_into(src: &[u8], dst: &mut [u64])
[src][−]
Reads unsigned 64 bit integers from src
into dst
. Read more
fn read_u128_into(src: &[u8], dst: &mut [u128])
[src][−]
Reads unsigned 128 bit integers from src
into dst
. Read more
fn write_u16_into(src: &[u16], dst: &mut [u8])
[src][−]
Writes unsigned 16 bit integers from src
into dst
. Read more
fn write_u32_into(src: &[u32], dst: &mut [u8])
[src][−]
Writes unsigned 32 bit integers from src
into dst
. Read more
fn write_u64_into(src: &[u64], dst: &mut [u8])
[src][−]
Writes unsigned 64 bit integers from src
into dst
. Read more
fn write_u128_into(src: &[u128], dst: &mut [u8])
[src][−]
Writes unsigned 128 bit integers from src
into dst
. Read more
fn from_slice_u16(numbers: &mut [u16])
[src][−]
Converts the given slice of unsigned 16 bit integers to a particular endianness. Read more
fn from_slice_u32(numbers: &mut [u32])
[src][−]
Converts the given slice of unsigned 32 bit integers to a particular endianness. Read more
fn from_slice_u64(numbers: &mut [u64])
[src][−]
Converts the given slice of unsigned 64 bit integers to a particular endianness. Read more
fn from_slice_u128(numbers: &mut [u128])
[src][−]
Converts the given slice of unsigned 128 bit integers to a particular endianness. Read more
fn from_slice_f32(numbers: &mut [f32])
[src][−]
Converts the given slice of IEEE754 single-precision (4 bytes) floating point numbers to a particular endianness. Read more
fn from_slice_f64(numbers: &mut [f64])
[src][−]
Converts the given slice of IEEE754 double-precision (8 bytes) floating point numbers to a particular endianness. Read more
fn read_u24(buf: &[u8]) -> u32
[src][−]
Reads an unsigned 24 bit integer from buf
, stored in u32. Read more
fn read_u48(buf: &[u8]) -> u64
[src][−]
Reads an unsigned 48 bit integer from buf
, stored in u64. Read more
fn write_u24(buf: &mut [u8], n: u32)
[src][−]
Writes an unsigned 24 bit integer n
to buf
, stored in u32. Read more
fn write_u48(buf: &mut [u8], n: u64)
[src][−]
Writes an unsigned 48 bit integer n
to buf
, stored in u64. Read more
fn read_i16(buf: &[u8]) -> i16
[src][−]
Reads a signed 16 bit integer from buf
. Read more
fn read_i24(buf: &[u8]) -> i32
[src][−]
Reads a signed 24 bit integer from buf
, stored in i32. Read more
fn read_i32(buf: &[u8]) -> i32
[src][−]
Reads a signed 32 bit integer from buf
. Read more
fn read_i48(buf: &[u8]) -> i64
[src][−]
Reads a signed 48 bit integer from buf
, stored in i64. Read more
fn read_i64(buf: &[u8]) -> i64
[src][−]
Reads a signed 64 bit integer from buf
. Read more
fn read_i128(buf: &[u8]) -> i128
[src][−]
Reads a signed 128 bit integer from buf
. Read more
fn read_int(buf: &[u8], nbytes: usize) -> i64
[src][−]
Reads a signed n-bytes integer from buf
. Read more
fn read_int128(buf: &[u8], nbytes: usize) -> i128
[src][−]
Reads a signed n-bytes integer from buf
. Read more
fn read_f32(buf: &[u8]) -> f32
[src][−]
Reads a IEEE754 single-precision (4 bytes) floating point number. Read more
fn read_f64(buf: &[u8]) -> f64
[src][−]
Reads a IEEE754 double-precision (8 bytes) floating point number. Read more
fn write_i16(buf: &mut [u8], n: i16)
[src][−]
Writes a signed 16 bit integer n
to buf
. Read more
fn write_i24(buf: &mut [u8], n: i32)
[src][−]
Writes a signed 24 bit integer n
to buf
, stored in i32. Read more
fn write_i32(buf: &mut [u8], n: i32)
[src][−]
Writes a signed 32 bit integer n
to buf
. Read more
fn write_i48(buf: &mut [u8], n: i64)
[src][−]
Writes a signed 48 bit integer n
to buf
, stored in i64. Read more
fn write_i64(buf: &mut [u8], n: i64)
[src][−]
Writes a signed 64 bit integer n
to buf
. Read more
fn write_i128(buf: &mut [u8], n: i128)
[src][−]
Writes a signed 128 bit integer n
to buf
. Read more
fn write_int(buf: &mut [u8], n: i64, nbytes: usize)
[src][−]
Writes a signed integer n
to buf
using only nbytes
. Read more
fn write_int128(buf: &mut [u8], n: i128, nbytes: usize)
[src][−]
Writes a signed integer n
to buf
using only nbytes
. Read more
fn write_f32(buf: &mut [u8], n: f32)
[src][−]
Writes a IEEE754 single-precision (4 bytes) floating point number. Read more
fn write_f64(buf: &mut [u8], n: f64)
[src][−]
Writes a IEEE754 double-precision (8 bytes) floating point number. Read more
fn read_i16_into(src: &[u8], dst: &mut [i16])
[src][−]
Reads signed 16 bit integers from src
to dst
. Read more
fn read_i32_into(src: &[u8], dst: &mut [i32])
[src][−]
Reads signed 32 bit integers from src
into dst
. Read more
fn read_i64_into(src: &[u8], dst: &mut [i64])
[src][−]
Reads signed 64 bit integers from src
into dst
. Read more
fn read_i128_into(src: &[u8], dst: &mut [i128])
[src][−]
Reads signed 128 bit integers from src
into dst
. Read more
fn read_f32_into(src: &[u8], dst: &mut [f32])
[src][−]
Reads IEEE754 single-precision (4 bytes) floating point numbers from
src
into dst
. Read more
fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
[src][−]
please use read_f32_into
instead
DEPRECATED. Read more
fn read_f64_into(src: &[u8], dst: &mut [f64])
[src][−]
Reads IEEE754 single-precision (4 bytes) floating point numbers from
src
into dst
. Read more
fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64])
[src][−]
please use read_f64_into
instead
DEPRECATED. Read more
fn write_i8_into(src: &[i8], dst: &mut [u8])
[src][−]
Writes signed 8 bit integers from src
into dst
. Read more
fn write_i16_into(src: &[i16], dst: &mut [u8])
[src][−]
Writes signed 16 bit integers from src
into dst
. Read more
fn write_i32_into(src: &[i32], dst: &mut [u8])
[src][−]
Writes signed 32 bit integers from src
into dst
. Read more
fn write_i64_into(src: &[i64], dst: &mut [u8])
[src][−]
Writes signed 64 bit integers from src
into dst
. Read more
fn write_i128_into(src: &[i128], dst: &mut [u8])
[src][−]
Writes signed 128 bit integers from src
into dst
. Read more
fn write_f32_into(src: &[f32], dst: &mut [u8])
[src][−]
Writes IEEE754 single-precision (4 bytes) floating point numbers from
src
into dst
. Read more
fn write_f64_into(src: &[f64], dst: &mut [u8])
[src][−]
Writes IEEE754 double-precision (8 bytes) floating point numbers from
src
into dst
. Read more
fn from_slice_i16(src: &mut [i16])
[src][−]
Converts the given slice of signed 16 bit integers to a particular endianness. Read more
fn from_slice_i32(src: &mut [i32])
[src][−]
Converts the given slice of signed 32 bit integers to a particular endianness. Read more
fn from_slice_i64(src: &mut [i64])
[src][−]
Converts the given slice of signed 64 bit integers to a particular endianness. Read more
fn from_slice_i128(src: &mut [i128])
[src][−]
Converts the given slice of signed 128 bit integers to a particular endianness. Read more
impl Clone for LittleEndian
[src][+]
fn clone(&self) -> LittleEndian
[src][−]
Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src][−]
Performs copy-assignment from source
. Read more
impl Copy for LittleEndian
[src]
impl Debug for LittleEndian
[src][+]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src][−]
Formats the value using the given formatter. Read more
impl Default for LittleEndian
[src][+]
fn default() -> LittleEndian
[src][−]
Returns the “default value” for a type. Read more
impl Eq for LittleEndian
[src]
impl Hash for LittleEndian
[src][+]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src][−]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src][−]
H: Hasher,
impl Ord for LittleEndian
[src][+]
fn cmp(&self, other: &LittleEndian) -> Ordering
[src][−]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src][−]
Compares and returns the maximum of two values. Read more
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src][−]
Compares and returns the minimum of two values. Read more
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src][−]
Restrict a value to a certain interval. Read more
impl PartialEq<LittleEndian> for LittleEndian
[src][+]
fn eq(&self, other: &LittleEndian) -> bool
[src][−]
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src][−]
This method tests for !=
.
impl PartialOrd<LittleEndian> for LittleEndian
[src][+]
fn partial_cmp(&self, other: &LittleEndian) -> Option<Ordering>
[src][−]
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src][−]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src][−]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src][−]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src][−]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl StructuralEq for LittleEndian
[src]
impl StructuralPartialEq for LittleEndian
[src]
Auto Trait Implementations
impl RefUnwindSafe for LittleEndian
impl Send for LittleEndian
impl Sync for LittleEndian
impl Unpin for LittleEndian
impl UnwindSafe for LittleEndian
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src][−]
Gets the TypeId
of self
. Read more
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
pub fn borrow(&self) -> &T
[src][−]
Immutably borrows from an owned value. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src][−]
Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src][−]
Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src][−]
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src][−]
Performs the conversion.
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,