[−][src]Enum byteorder::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]
impl ByteOrder for LittleEndian
fn read_u16(buf: &[u8]) -> u16
[src]
fn read_u16(buf: &[u8]) -> u16
Reads an unsigned 16 bit integer from buf
. Read more
fn read_u32(buf: &[u8]) -> u32
[src]
fn read_u32(buf: &[u8]) -> u32
Reads an unsigned 32 bit integer from buf
. Read more
fn read_u64(buf: &[u8]) -> u64
[src]
fn read_u64(buf: &[u8]) -> u64
Reads an unsigned 64 bit integer from buf
. Read more
fn read_uint(buf: &[u8], nbytes: usize) -> u64
[src]
fn read_uint(buf: &[u8], nbytes: usize) -> u64
Reads an unsigned n-bytes integer from buf
. Read more
fn write_u16(buf: &mut [u8], n: u16)
[src]
fn write_u16(buf: &mut [u8], n: u16)
Writes an unsigned 16 bit integer n
to buf
. Read more
fn write_u32(buf: &mut [u8], n: u32)
[src]
fn write_u32(buf: &mut [u8], n: u32)
Writes an unsigned 32 bit integer n
to buf
. Read more
fn write_u64(buf: &mut [u8], n: u64)
[src]
fn write_u64(buf: &mut [u8], n: u64)
Writes an unsigned 64 bit integer n
to buf
. Read more
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
[src]
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
Writes an unsigned integer n
to buf
using only nbytes
. Read more
fn read_u16_into(src: &[u8], dst: &mut [u16])
[src]
fn read_u16_into(src: &[u8], dst: &mut [u16])
Reads unsigned 16 bit integers from src
into dst
. Read more
fn read_u32_into(src: &[u8], dst: &mut [u32])
[src]
fn read_u32_into(src: &[u8], dst: &mut [u32])
Reads unsigned 32 bit integers from src
into dst
. Read more
fn read_u64_into(src: &[u8], dst: &mut [u64])
[src]
fn read_u64_into(src: &[u8], dst: &mut [u64])
Reads unsigned 64 bit integers from src
into dst
. Read more
fn write_u16_into(src: &[u16], dst: &mut [u8])
[src]
fn write_u16_into(src: &[u16], dst: &mut [u8])
Writes unsigned 16 bit integers from src
into dst
. Read more
fn write_u32_into(src: &[u32], dst: &mut [u8])
[src]
fn write_u32_into(src: &[u32], dst: &mut [u8])
Writes unsigned 32 bit integers from src
into dst
. Read more
fn write_u64_into(src: &[u64], dst: &mut [u8])
[src]
fn write_u64_into(src: &[u64], dst: &mut [u8])
Writes unsigned 64 bit integers from src
into dst
. Read more
fn from_slice_u16(numbers: &mut [u16])
[src]
fn from_slice_u16(numbers: &mut [u16])
Converts the given slice of unsigned 16 bit integers to a particular endianness. Read more
fn from_slice_u32(numbers: &mut [u32])
[src]
fn from_slice_u32(numbers: &mut [u32])
Converts the given slice of unsigned 32 bit integers to a particular endianness. Read more
fn from_slice_u64(numbers: &mut [u64])
[src]
fn from_slice_u64(numbers: &mut [u64])
Converts the given slice of unsigned 64 bit integers to a particular endianness. Read more
fn from_slice_f32(numbers: &mut [f32])
[src]
fn from_slice_f32(numbers: &mut [f32])
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]
fn from_slice_f64(numbers: &mut [f64])
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]
fn read_u24(buf: &[u8]) -> u32
Reads an unsigned 24 bit integer from buf
, stored in u32. Read more
fn read_u48(buf: &[u8]) -> u64
[src]
fn read_u48(buf: &[u8]) -> u64
Reads an unsigned 48 bit integer from buf
, stored in u64. Read more
fn write_u24(buf: &mut [u8], n: u32)
[src]
fn write_u24(buf: &mut [u8], n: u32)
Writes an unsigned 24 bit integer n
to buf
, stored in u32. Read more
fn write_u48(buf: &mut [u8], n: u64)
[src]
fn write_u48(buf: &mut [u8], n: u64)
Writes an unsigned 48 bit integer n
to buf
, stored in u64. Read more
fn read_i16(buf: &[u8]) -> i16
[src]
fn read_i16(buf: &[u8]) -> i16
Reads a signed 16 bit integer from buf
. Read more
fn read_i24(buf: &[u8]) -> i32
[src]
fn read_i24(buf: &[u8]) -> i32
Reads a signed 24 bit integer from buf
, stored in i32. Read more
fn read_i32(buf: &[u8]) -> i32
[src]
fn read_i32(buf: &[u8]) -> i32
Reads a signed 32 bit integer from buf
. Read more
fn read_i48(buf: &[u8]) -> i64
[src]
fn read_i48(buf: &[u8]) -> i64
Reads a signed 48 bit integer from buf
, stored in i64. Read more
fn read_i64(buf: &[u8]) -> i64
[src]
fn read_i64(buf: &[u8]) -> i64
Reads a signed 64 bit integer from buf
. Read more
fn read_int(buf: &[u8], nbytes: usize) -> i64
[src]
fn read_int(buf: &[u8], nbytes: usize) -> i64
Reads a signed n-bytes integer from buf
. Read more
fn read_f32(buf: &[u8]) -> f32
[src]
fn read_f32(buf: &[u8]) -> f32
Reads a IEEE754 single-precision (4 bytes) floating point number. Read more
fn read_f64(buf: &[u8]) -> f64
[src]
fn read_f64(buf: &[u8]) -> f64
Reads a IEEE754 double-precision (8 bytes) floating point number. Read more
fn write_i16(buf: &mut [u8], n: i16)
[src]
fn write_i16(buf: &mut [u8], n: i16)
Writes a signed 16 bit integer n
to buf
. Read more
fn write_i24(buf: &mut [u8], n: i32)
[src]
fn write_i24(buf: &mut [u8], n: i32)
Writes a signed 24 bit integer n
to buf
, stored in i32. Read more
fn write_i32(buf: &mut [u8], n: i32)
[src]
fn write_i32(buf: &mut [u8], n: i32)
Writes a signed 32 bit integer n
to buf
. Read more
fn write_i48(buf: &mut [u8], n: i64)
[src]
fn write_i48(buf: &mut [u8], n: i64)
Writes a signed 48 bit integer n
to buf
, stored in i64. Read more
fn write_i64(buf: &mut [u8], n: i64)
[src]
fn write_i64(buf: &mut [u8], n: i64)
Writes a signed 64 bit integer n
to buf
. Read more
fn write_int(buf: &mut [u8], n: i64, nbytes: usize)
[src]
fn write_int(buf: &mut [u8], n: i64, nbytes: usize)
Writes a signed integer n
to buf
using only nbytes
. Read more
fn write_f32(buf: &mut [u8], n: f32)
[src]
fn write_f32(buf: &mut [u8], n: f32)
Writes a IEEE754 single-precision (4 bytes) floating point number. Read more
fn write_f64(buf: &mut [u8], n: f64)
[src]
fn write_f64(buf: &mut [u8], n: f64)
Writes a IEEE754 double-precision (8 bytes) floating point number. Read more
fn read_i16_into(src: &[u8], dst: &mut [i16])
[src]
fn read_i16_into(src: &[u8], dst: &mut [i16])
Reads signed 16 bit integers from src
to dst
. Read more
fn read_i32_into(src: &[u8], dst: &mut [i32])
[src]
fn read_i32_into(src: &[u8], dst: &mut [i32])
Reads signed 32 bit integers from src
into dst
. Read more
fn read_i64_into(src: &[u8], dst: &mut [i64])
[src]
fn read_i64_into(src: &[u8], dst: &mut [i64])
Reads signed 64 bit integers from src
into dst
. Read more
fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
[src]
fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
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]
fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64])
Reads IEEE754 single-precision (4 bytes) floating point numbers from src
into dst
. Read more
fn write_i16_into(src: &[i16], dst: &mut [u8])
[src]
fn write_i16_into(src: &[i16], dst: &mut [u8])
Writes signed 16 bit integers from src
into dst
. Read more
fn write_i32_into(src: &[i32], dst: &mut [u8])
[src]
fn write_i32_into(src: &[i32], dst: &mut [u8])
Writes signed 32 bit integers from src
into dst
. Read more
fn write_i64_into(src: &[i64], dst: &mut [u8])
[src]
fn write_i64_into(src: &[i64], dst: &mut [u8])
Writes signed 64 bit integers from src
into dst
. Read more
fn write_f32_into(src: &[f32], dst: &mut [u8])
[src]
fn write_f32_into(src: &[f32], dst: &mut [u8])
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]
fn write_f64_into(src: &[f64], dst: &mut [u8])
Writes IEEE754 double-precision (8 bytes) floating point numbers from src
into dst
. Read more
fn from_slice_i16(src: &mut [i16])
[src]
fn from_slice_i16(src: &mut [i16])
Converts the given slice of signed 16 bit integers to a particular endianness. Read more
fn from_slice_i32(src: &mut [i32])
[src]
fn from_slice_i32(src: &mut [i32])
Converts the given slice of signed 32 bit integers to a particular endianness. Read more
fn from_slice_i64(src: &mut [i64])
[src]
fn from_slice_i64(src: &mut [i64])
Converts the given slice of signed 64 bit integers to a particular endianness. Read more
impl PartialOrd<LittleEndian> for LittleEndian
[src]
impl PartialOrd<LittleEndian> for LittleEndian
fn partial_cmp(&self, other: &LittleEndian) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &LittleEndian) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Default for LittleEndian
[src]
impl Default for LittleEndian
fn default() -> LittleEndian
[src]
fn default() -> LittleEndian
Returns the "default value" for a type. Read more
impl Ord for LittleEndian
[src]
impl Ord for LittleEndian
fn cmp(&self, other: &LittleEndian) -> Ordering
[src]
fn cmp(&self, other: &LittleEndian) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq<LittleEndian> for LittleEndian
[src]
impl PartialEq<LittleEndian> for LittleEndian
fn eq(&self, other: &LittleEndian) -> bool
[src]
fn eq(&self, other: &LittleEndian) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Clone for LittleEndian
[src]
impl Clone for LittleEndian
fn clone(&self) -> LittleEndian
[src]
fn clone(&self) -> LittleEndian
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for LittleEndian
[src]
impl Copy for LittleEndian
impl Eq for LittleEndian
[src]
impl Eq for LittleEndian
impl Hash for LittleEndian
[src]
impl Hash for LittleEndian
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for LittleEndian
[src]
impl Debug for LittleEndian
Auto Trait Implementations
impl Send for LittleEndian
impl Send for LittleEndian
impl Sync for LittleEndian
impl Sync for LittleEndian
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 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> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more