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§
Source§impl ByteOrder for BigEndian
impl ByteOrder for BigEndian
Source§fn read_uint(buf: &[u8], nbytes: usize) -> u64
fn read_uint(buf: &[u8], nbytes: usize) -> u64
Reads an unsigned n-bytes integer from
buf. Read moreSource§fn read_uint128(buf: &[u8], nbytes: usize) -> u128
fn read_uint128(buf: &[u8], nbytes: usize) -> u128
Reads an unsigned n-bytes integer from
buf. Read moreSource§fn read_u16_into(src: &[u8], dst: &mut [u16])
fn read_u16_into(src: &[u8], dst: &mut [u16])
Source§fn read_u32_into(src: &[u8], dst: &mut [u32])
fn read_u32_into(src: &[u8], dst: &mut [u32])
Source§fn read_u64_into(src: &[u8], dst: &mut [u64])
fn read_u64_into(src: &[u8], dst: &mut [u64])
Source§fn read_u128_into(src: &[u8], dst: &mut [u128])
fn read_u128_into(src: &[u8], dst: &mut [u128])
Source§fn write_u16_into(src: &[u16], dst: &mut [u8])
fn write_u16_into(src: &[u16], dst: &mut [u8])
Source§fn write_u32_into(src: &[u32], dst: &mut [u8])
fn write_u32_into(src: &[u32], dst: &mut [u8])
Source§fn write_u64_into(src: &[u64], dst: &mut [u8])
fn write_u64_into(src: &[u64], dst: &mut [u8])
Source§fn write_u128_into(src: &[u128], dst: &mut [u8])
fn write_u128_into(src: &[u128], dst: &mut [u8])
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn read_u24(buf: &[u8]) -> u32
fn read_u24(buf: &[u8]) -> u32
Reads an unsigned 24 bit integer from
buf, stored in u32. Read moreSource§fn read_u48(buf: &[u8]) -> u64
fn read_u48(buf: &[u8]) -> u64
Reads an unsigned 48 bit integer from
buf, stored in u64. Read moreSource§fn read_i24(buf: &[u8]) -> i32
fn read_i24(buf: &[u8]) -> i32
Reads a signed 24 bit integer from
buf, stored in i32. Read moreSource§fn read_i48(buf: &[u8]) -> i64
fn read_i48(buf: &[u8]) -> i64
Reads a signed 48 bit integer from
buf, stored in i64. Read moreSource§fn read_int(buf: &[u8], nbytes: usize) -> i64
fn read_int(buf: &[u8], nbytes: usize) -> i64
Reads a signed n-bytes integer from
buf. Read moreSource§fn read_int128(buf: &[u8], nbytes: usize) -> i128
fn read_int128(buf: &[u8], nbytes: usize) -> i128
Reads a signed n-bytes integer from
buf. Read moreSource§fn read_f32(buf: &[u8]) -> f32
fn read_f32(buf: &[u8]) -> f32
Reads a IEEE754 single-precision (4 bytes) floating point number. Read more
Source§fn read_f64(buf: &[u8]) -> f64
fn read_f64(buf: &[u8]) -> f64
Reads a IEEE754 double-precision (8 bytes) floating point number. Read more
Source§fn 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
Source§fn 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
Source§fn read_i16_into(src: &[u8], dst: &mut [i16])
fn read_i16_into(src: &[u8], dst: &mut [i16])
Source§fn read_i32_into(src: &[u8], dst: &mut [i32])
fn read_i32_into(src: &[u8], dst: &mut [i32])
Source§fn read_i64_into(src: &[u8], dst: &mut [i64])
fn read_i64_into(src: &[u8], dst: &mut [i64])
Source§fn read_i128_into(src: &[u8], dst: &mut [i128])
fn read_i128_into(src: &[u8], dst: &mut [i128])
Source§fn read_f32_into(src: &[u8], dst: &mut [f32])
fn read_f32_into(src: &[u8], dst: &mut [f32])
Source§fn 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 instead
DEPRECATED. Read more
Source§fn read_f64_into(src: &[u8], dst: &mut [f64])
fn read_f64_into(src: &[u8], dst: &mut [f64])
Source§fn 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 instead
DEPRECATED. Read more
Source§fn write_i8_into(src: &[i8], dst: &mut [u8])
fn write_i8_into(src: &[i8], dst: &mut [u8])
Source§fn write_i16_into(src: &[i16], dst: &mut [u8])
fn write_i16_into(src: &[i16], dst: &mut [u8])
Source§fn write_i32_into(src: &[i32], dst: &mut [u8])
fn write_i32_into(src: &[i32], dst: &mut [u8])
Source§fn write_i64_into(src: &[i64], dst: &mut [u8])
fn write_i64_into(src: &[i64], dst: &mut [u8])
Source§fn write_i128_into(src: &[i128], dst: &mut [u8])
fn write_i128_into(src: &[i128], dst: &mut [u8])
Source§fn write_f32_into(src: &[f32], dst: &mut [u8])
fn write_f32_into(src: &[f32], dst: &mut [u8])
Source§fn write_f64_into(src: &[f64], dst: &mut [u8])
fn write_f64_into(src: &[f64], dst: &mut [u8])
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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
Source§impl Ord for BigEndian
impl Ord for BigEndian
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for BigEndian
impl PartialOrd for BigEndian
impl Copy for BigEndian
impl Eq for BigEndian
impl StructuralPartialEq for BigEndian
Auto Trait Implementations§
impl Freeze for BigEndian
impl RefUnwindSafe for BigEndian
impl Send for BigEndian
impl Sync for BigEndian
impl Unpin for BigEndian
impl UnsafeUnpin for BigEndian
impl UnwindSafe for BigEndian
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<A> DynCastExt for A
impl<A> DynCastExt for A
Source§fn dyn_cast<T>(
self,
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source>where
A: DynCastExtHelper<T>,
T: ?Sized,
fn dyn_cast<T>(
self,
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source>where
A: DynCastExtHelper<T>,
T: ?Sized,
Use this to cast from one trait object type to another. Read more
Source§fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target
fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target
Use this to upcast a trait to one of its supertraits. Read more
Source§fn dyn_cast_adv<F, T>(
self,
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source>
fn dyn_cast_adv<F, T>( self, ) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source>
Source§fn dyn_cast_with_config<C>(
self,
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source>where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
fn dyn_cast_with_config<C>(
self,
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source>where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
Use this to cast from one trait object type to another. With this method
the type parameter is a config type that uniquely specifies which cast
should be preformed. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more