[−][src]Enum byteordered::Endianness
Enumerate for materializing the two kinds of machine byte order supported by Rust.
Variants
Little Endian
Big Endian
Methods
impl Endianness
[src]
pub fn native() -> Self
[src]
Obtains this system's native endianness.
On this platform, the function returns Endianness::Little
.
pub fn le_iff(e: bool) -> Self
[src]
Obtains Little Endian if and only if the given value is true
.
Examples
let data: &[u8] = &[4, 1]; let e = Endianness::le_iff(2 + 2 == 4); assert_eq!(e.read_u16(data).unwrap(), 260); let e = Endianness::le_iff(2 + 2 >= 5); assert_eq!(e.read_u16(data).unwrap(), 1025);
pub fn be_iff(e: bool) -> Self
[src]
Obtains Big Endian if and only if the given value is true
.
Examples
assert_eq!(Endianness::be_iff(2 + 2 == 4), Endianness::Big); assert_eq!(Endianness::be_iff(2 + 2 >= 5), Endianness::Little);
pub fn to_opposite(self) -> Self
[src]
Obtains the opposite endianness: Little Endian returns Big Endian and vice versa.
Trait Implementations
impl Endian for Endianness
[src]
type Opposite = Self
A type which can represent a byte order that is opposite to this one.
fn into_opposite(self) -> Self::Opposite
[src]
fn is_native(&self) -> bool
[src]
fn read_i16<S>(&self, src: S) -> IoResult<i16> where
S: Read,
[src]
S: Read,
fn read_u16<S>(&self, src: S) -> IoResult<u16> where
S: Read,
[src]
S: Read,
fn read_i32<S>(&self, src: S) -> IoResult<i32> where
S: Read,
[src]
S: Read,
fn read_u32<S>(&self, src: S) -> IoResult<u32> where
S: Read,
[src]
S: Read,
fn read_i64<S>(&self, src: S) -> IoResult<i64> where
S: Read,
[src]
S: Read,
fn read_u64<S>(&self, src: S) -> IoResult<u64> where
S: Read,
[src]
S: Read,
fn read_f32<S>(&self, src: S) -> IoResult<f32> where
S: Read,
[src]
S: Read,
fn read_f64<S>(&self, src: S) -> IoResult<f64> where
S: Read,
[src]
S: Read,
fn read_i128<S>(&self, src: S) -> IoResult<i128> where
S: Read,
[src]
S: Read,
fn read_u128<S>(&self, src: S) -> IoResult<u128> where
S: Read,
[src]
S: Read,
fn write_i16<S>(&self, src: S, v: i16) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_u16<S>(&self, src: S, v: u16) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_i32<S>(&self, src: S, v: i32) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_u32<S>(&self, src: S, v: u32) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_i64<S>(&self, src: S, v: i64) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_u64<S>(&self, src: S, v: u64) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_f32<S>(&self, src: S, v: f32) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_f64<S>(&self, src: S, v: f64) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_i128<S>(&self, src: S, v: i128) -> IoResult<()> where
S: Write,
[src]
S: Write,
fn write_u128<S>(&self, src: S, v: u128) -> IoResult<()> where
S: Write,
[src]
S: Write,
impl From<StaticEndianness<LittleEndian>> for Endianness
[src]
fn from(_: StaticEndianness<LittleEndian>) -> Self
[src]
impl From<StaticEndianness<BigEndian>> for Endianness
[src]
fn from(_: StaticEndianness<BigEndian>) -> Self
[src]
impl Clone for Endianness
[src]
fn clone(&self) -> Endianness
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Endianness
[src]
impl Eq for Endianness
[src]
impl Ord for Endianness
[src]
fn cmp(&self, other: &Endianness) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Endianness> for StaticEndianness<BigEndian>
[src]
impl PartialEq<Endianness> for StaticEndianness<LittleEndian>
[src]
impl PartialEq<Endianness> for Endianness
[src]
fn eq(&self, other: &Endianness) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<StaticEndianness<BigEndian>> for Endianness
[src]
fn eq(&self, _: &StaticEndianness<BigEndian>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<StaticEndianness<LittleEndian>> for Endianness
[src]
fn eq(&self, _: &StaticEndianness<LittleEndian>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Endianness> for Endianness
[src]
fn partial_cmp(&self, other: &Endianness) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Debug for Endianness
[src]
impl Hash for Endianness
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for Endianness
[src]
impl StructuralEq for Endianness
[src]
Auto Trait Implementations
impl Send for Endianness
impl Sync for Endianness
impl Unpin for Endianness
impl UnwindSafe for Endianness
impl RefUnwindSafe for Endianness
Blanket Implementations
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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,