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
impl ByteOrder for BigEndian
impl ByteOrder for BigEndian
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 more
fn write_u128(buf: &mut [u8], n: u128)
fn write_u128(buf: &mut [u8], n: u128)
Writes an unsigned 128 bit integer n
to buf
. Read more
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
fn write_uint(buf: &mut [u8], n: u64, nbytes: usize)
Writes an unsigned integer n
to buf
using only nbytes
. Read more
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize)
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize)
Writes an unsigned integer n
to buf
using only nbytes
. Read more
fn read_u16_into(src: &[u8], dst: &mut [u16])
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])
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])
fn read_u64_into(src: &[u8], dst: &mut [u64])
Reads unsigned 64 bit integers from src
into dst
. Read more
fn read_u128_into(src: &[u8], dst: &mut [u128])
fn read_u128_into(src: &[u8], dst: &mut [u128])
Reads unsigned 128 bit integers from src
into dst
. Read more
fn write_u16_into(src: &[u16], dst: &mut [u8])
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])
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])
fn write_u64_into(src: &[u64], dst: &mut [u8])
Writes unsigned 64 bit integers from src
into dst
. Read more
fn write_u128_into(src: &[u128], dst: &mut [u8])
fn write_u128_into(src: &[u128], dst: &mut [u8])
Writes unsigned 128 bit integers from src
into dst
. Read more
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
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
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
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
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
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
fn write_u24(buf: &mut [u8], n: u32)
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)
fn write_u48(buf: &mut [u8], n: u64)
Writes an unsigned 48 bit integer n
to buf
, stored in u64. Read more
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 more
fn read_f32(buf: &[u8]) -> f32
fn read_f32(buf: &[u8]) -> f32
Reads a IEEE754 single-precision (4 bytes) floating point number. Read more
fn read_f64(buf: &[u8]) -> f64
fn read_f64(buf: &[u8]) -> f64
Reads a IEEE754 double-precision (8 bytes) floating point number. Read more
fn write_i24(buf: &mut [u8], n: i32)
fn write_i24(buf: &mut [u8], n: i32)
Writes a signed 24 bit integer n
to buf
, stored in i32. Read more
fn write_i48(buf: &mut [u8], n: i64)
fn write_i48(buf: &mut [u8], n: i64)
Writes a signed 48 bit integer n
to buf
, stored in i64. Read more
fn write_i128(buf: &mut [u8], n: i128)
fn write_i128(buf: &mut [u8], n: i128)
Writes a signed 128 bit integer n
to buf
. Read more
fn write_int(buf: &mut [u8], n: i64, nbytes: usize)
fn write_int(buf: &mut [u8], n: i64, nbytes: usize)
Writes a signed integer n
to buf
using only nbytes
. Read more
fn write_int128(buf: &mut [u8], n: i128, nbytes: usize)
fn write_int128(buf: &mut [u8], n: i128, nbytes: usize)
Writes a signed integer n
to buf
using only nbytes
. Read more
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
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
fn read_i16_into(src: &[u8], dst: &mut [i16])
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])
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])
fn read_i64_into(src: &[u8], dst: &mut [i64])
Reads signed 64 bit integers from src
into dst
. Read more
fn read_i128_into(src: &[u8], dst: &mut [i128])
fn read_i128_into(src: &[u8], dst: &mut [i128])
Reads signed 128 bit integers from src
into dst
. Read more
fn read_f32_into(src: &[u8], dst: &mut [f32])
fn read_f32_into(src: &[u8], dst: &mut [f32])
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])
fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32])
please use read_f32_into
instead
DEPRECATED. Read more
fn read_f64_into(src: &[u8], dst: &mut [f64])
fn read_f64_into(src: &[u8], dst: &mut [f64])
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])
fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64])
please use read_f64_into
instead
DEPRECATED. Read more
fn write_i8_into(src: &[i8], dst: &mut [u8])
fn write_i8_into(src: &[i8], dst: &mut [u8])
Writes signed 8 bit integers from src
into dst
. Read more
fn write_i16_into(src: &[i16], dst: &mut [u8])
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])
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])
fn write_i64_into(src: &[i64], dst: &mut [u8])
Writes signed 64 bit integers from src
into dst
. Read more
fn write_i128_into(src: &[i128], dst: &mut [u8])
fn write_i128_into(src: &[i128], dst: &mut [u8])
Writes signed 128 bit integers from src
into dst
. Read more
fn write_f32_into(src: &[f32], dst: &mut [u8])
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])
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])
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])
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])
fn from_slice_i64(src: &mut [i64])
Converts the given slice of signed 64 bit integers to a particular endianness. Read more
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
impl Ord for BigEndian
impl Ord for BigEndian
impl PartialOrd<BigEndian> for BigEndian
impl PartialOrd<BigEndian> for BigEndian
fn partial_cmp(&self, other: &BigEndian) -> Option<Ordering>
fn partial_cmp(&self, other: &BigEndian) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn 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. Read more
sourcefn 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. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<A> DynCastExt for A
impl<A> DynCastExt for A
sourcefn 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
sourcefn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
Use this to upcast a trait to one of its supertraits. Read more
sourcefn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
sourcefn 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