pub enum BigEndian {}
Expand description
Defines big-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 big endian order:
use byteorder::{ByteOrder, BigEndian};
let mut buf = [0; 4];
BigEndian::write_u32(&mut buf, 1_000_000);
assert_eq!(1_000_000, BigEndian::read_u32(&buf));
Trait Implementations
sourceimpl ByteOrder for BigEndian
impl ByteOrder for BigEndian
sourcefn read_uint(buf: &[u8], nbytes: usize) -> u64
fn read_uint(buf: &[u8], nbytes: usize) -> u64
Reads an unsigned n-bytes integer from
buf
. Read moresourcefn read_uint128(buf: &[u8], nbytes: usize) -> u128
fn read_uint128(buf: &[u8], nbytes: usize) -> u128
Reads an unsigned n-bytes integer from
buf
. Read moresourcefn write_u128(buf: &mut [u8], n: u128)
fn write_u128(buf: &mut [u8], n: u128)
sourcefn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
sourcefn write_uint128(buf: &mut [u8], n: u128, nbytes: usize)
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize)
sourcefn read_u16_into(src: &[u8], dst: &mut [u16])
fn read_u16_into(src: &[u8], dst: &mut [u16])
sourcefn read_u32_into(src: &[u8], dst: &mut [u32])
fn read_u32_into(src: &[u8], dst: &mut [u32])
sourcefn read_u64_into(src: &[u8], dst: &mut [u64])
fn read_u64_into(src: &[u8], dst: &mut [u64])
sourcefn read_u128_into(src: &[u8], dst: &mut [u128])
fn read_u128_into(src: &[u8], dst: &mut [u128])
sourcefn write_u16_into(src: &[u16], dst: &mut [u8])
fn write_u16_into(src: &[u16], dst: &mut [u8])
sourcefn write_u32_into(src: &[u32], dst: &mut [u8])
fn write_u32_into(src: &[u32], dst: &mut [u8])
sourcefn write_u64_into(src: &[u64], dst: &mut [u8])
fn write_u64_into(src: &[u64], dst: &mut [u8])
sourcefn write_u128_into(src: &[u128], dst: &mut [u8])
fn write_u128_into(src: &[u128], dst: &mut [u8])
sourcefn from_slice_u16(numbers: &mut [u16])
fn from_slice_u16(numbers: &mut [u16])
Converts the given slice of unsigned 16 bit integers to a particular
endianness. Read more
sourcefn from_slice_u32(numbers: &mut [u32])
fn from_slice_u32(numbers: &mut [u32])
Converts the given slice of unsigned 32 bit integers to a particular
endianness. Read more
sourcefn from_slice_u64(numbers: &mut [u64])
fn from_slice_u64(numbers: &mut [u64])
Converts the given slice of unsigned 64 bit integers to a particular
endianness. Read more
sourcefn from_slice_u128(numbers: &mut [u128])
fn from_slice_u128(numbers: &mut [u128])
Converts the given slice of unsigned 128 bit integers to a particular
endianness. Read more
sourcefn from_slice_f32(numbers: &mut [f32])
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
sourcefn from_slice_f64(numbers: &mut [f64])
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
sourcefn read_u24(buf: &[u8]) -> u32
fn read_u24(buf: &[u8]) -> u32
Reads an unsigned 24 bit integer from
buf
, stored in u32. Read moresourcefn read_u48(buf: &[u8]) -> u64
fn read_u48(buf: &[u8]) -> u64
Reads an unsigned 48 bit integer from
buf
, stored in u64. Read moresourcefn read_i24(buf: &[u8]) -> i32
fn read_i24(buf: &[u8]) -> i32
Reads a signed 24 bit integer from
buf
, stored in i32. Read moresourcefn read_i48(buf: &[u8]) -> i64
fn read_i48(buf: &[u8]) -> i64
Reads a signed 48 bit integer from
buf
, stored in i64. Read moresourcefn read_int(buf: &[u8], nbytes: usize) -> i64
fn read_int(buf: &[u8], nbytes: usize) -> i64
Reads a signed n-bytes integer from
buf
. Read moresourcefn read_int128(buf: &[u8], nbytes: usize) -> i128
fn read_int128(buf: &[u8], nbytes: usize) -> i128
Reads a signed n-bytes integer from
buf
. Read moresourcefn read_f32(buf: &[u8]) -> f32
fn read_f32(buf: &[u8]) -> f32
Reads a IEEE754 single-precision (4 bytes) floating point number. Read more
sourcefn read_f64(buf: &[u8]) -> f64
fn read_f64(buf: &[u8]) -> f64
Reads a IEEE754 double-precision (8 bytes) floating point number. Read more
sourcefn write_i128(buf: &mut [u8], n: i128)
fn write_i128(buf: &mut [u8], n: i128)
sourcefn write_int128(buf: &mut [u8], n: i128, nbytes: usize)
fn write_int128(buf: &mut [u8], n: i128, nbytes: usize)
sourcefn write_f32(buf: &mut [u8], n: f32)
fn write_f32(buf: &mut [u8], n: f32)
Writes a IEEE754 single-precision (4 bytes) floating point number. Read more
sourcefn write_f64(buf: &mut [u8], n: f64)
fn write_f64(buf: &mut [u8], n: f64)
Writes a IEEE754 double-precision (8 bytes) floating point number. Read more
sourcefn read_i16_into(src: &[u8], dst: &mut [i16])
fn read_i16_into(src: &[u8], dst: &mut [i16])
sourcefn read_i32_into(src: &[u8], dst: &mut [i32])
fn read_i32_into(src: &[u8], dst: &mut [i32])
sourcefn read_i64_into(src: &[u8], dst: &mut [i64])
fn read_i64_into(src: &[u8], dst: &mut [i64])
sourcefn read_i128_into(src: &[u8], dst: &mut [i128])
fn read_i128_into(src: &[u8], dst: &mut [i128])
sourcefn read_f32_into(src: &[u8], dst: &mut [f32])
fn read_f32_into(src: &[u8], dst: &mut [f32])
sourcefn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
👎Deprecated since 1.3.0: please use
read_f32_into
insteadDEPRECATED. Read more
sourcefn read_f64_into(src: &[u8], dst: &mut [f64])
fn read_f64_into(src: &[u8], dst: &mut [f64])
sourcefn read_f64_into_unchecked(src: &[u8], dst: &mut [f64])
fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64])
👎Deprecated since 1.3.0: please use
read_f64_into
insteadDEPRECATED. Read more
sourcefn write_i8_into(src: &[i8], dst: &mut [u8])
fn write_i8_into(src: &[i8], dst: &mut [u8])
sourcefn write_i16_into(src: &[i16], dst: &mut [u8])
fn write_i16_into(src: &[i16], dst: &mut [u8])
sourcefn write_i32_into(src: &[i32], dst: &mut [u8])
fn write_i32_into(src: &[i32], dst: &mut [u8])
sourcefn write_i64_into(src: &[i64], dst: &mut [u8])
fn write_i64_into(src: &[i64], dst: &mut [u8])
sourcefn write_i128_into(src: &[i128], dst: &mut [u8])
fn write_i128_into(src: &[i128], dst: &mut [u8])
sourcefn write_f32_into(src: &[f32], dst: &mut [u8])
fn write_f32_into(src: &[f32], dst: &mut [u8])
sourcefn write_f64_into(src: &[f64], dst: &mut [u8])
fn write_f64_into(src: &[f64], dst: &mut [u8])
sourcefn from_slice_i16(src: &mut [i16])
fn from_slice_i16(src: &mut [i16])
Converts the given slice of signed 16 bit integers to a particular
endianness. Read more
sourcefn from_slice_i32(src: &mut [i32])
fn from_slice_i32(src: &mut [i32])
Converts the given slice of signed 32 bit integers to a particular
endianness. Read more
sourcefn from_slice_i64(src: &mut [i64])
fn from_slice_i64(src: &mut [i64])
Converts the given slice of signed 64 bit integers to a particular
endianness. Read more
sourcefn from_slice_i128(src: &mut [i128])
fn from_slice_i128(src: &mut [i128])
Converts the given slice of signed 128 bit integers to a particular
endianness. Read more
sourceimpl Hash for BigEndian
impl Hash for BigEndian
sourcefn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [
Hasher
]. Read more1.3.0fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
Feeds a slice of this type into the given [
Hasher
]. Read moresourceimpl Ord for BigEndian
impl Ord for BigEndian
sourceimpl PartialOrd<BigEndian> for BigEndian
impl PartialOrd<BigEndian> for BigEndian
sourcefn partial_cmp(&self, other: &BigEndian) -> Option<Ordering>
fn partial_cmp(&self, other: &BigEndian) -> Option<Ordering>
1.0.0const fn lt(&self, other: &Rhs) -> bool
const fn lt(&self, other: &Rhs) -> bool
1.0.0const fn le(&self, other: &Rhs) -> bool
const 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 more1.0.0const fn gt(&self, other: &Rhs) -> bool
const fn gt(&self, other: &Rhs) -> bool
impl Copy for BigEndian
impl Eq for BigEndian
impl StructuralEq for BigEndian
impl StructuralPartialEq for BigEndian
Auto Trait Implementations
impl RefUnwindSafe for BigEndian
impl Send for BigEndian
impl Sync for BigEndian
impl Unpin for BigEndian
impl UnwindSafe for BigEndian
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more