[−][src]Struct read_from::NativeEndian
A type that can be used to deserialize integers in native-endian format.
Example
use read_from::{WriteTo, ReadFrom, NativeEndian}; use std::io::Cursor; let mut buf = vec![]; NativeEndian(0xaabbccdd_u32).write_to(&mut buf).unwrap(); if cfg!(target_endian="little") { assert_eq!(buf, [0xdd, 0xcc, 0xbb, 0xaa]); } else { assert_eq!(buf, [0xaa, 0xbb, 0xcc, 0xdd]); } let cursor = Cursor::new(&buf); assert_eq!(0xaabbccdd_u32, NativeEndian::read_from(cursor).unwrap().0);
Trait Implementations
impl<T: Clone> Clone for NativeEndian<T>[src]
fn clone(&self) -> NativeEndian<T>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: Copy> Copy for NativeEndian<T>[src]
impl<T: Debug> Debug for NativeEndian<T>[src]
impl<T: Default> Default for NativeEndian<T>[src]
fn default() -> NativeEndian<T>[src]
impl<T: Eq> Eq for NativeEndian<T>[src]
impl<T: Hash> Hash for NativeEndian<T>[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<T: Ord> Ord for NativeEndian<T>[src]
fn cmp(&self, other: &NativeEndian<T>) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<T: PartialEq> PartialEq<NativeEndian<T>> for NativeEndian<T>[src]
fn eq(&self, other: &NativeEndian<T>) -> bool[src]
fn ne(&self, other: &NativeEndian<T>) -> bool[src]
impl<T: PartialOrd> PartialOrd<NativeEndian<T>> for NativeEndian<T>[src]
fn partial_cmp(&self, other: &NativeEndian<T>) -> Option<Ordering>[src]
fn lt(&self, other: &NativeEndian<T>) -> bool[src]
fn le(&self, other: &NativeEndian<T>) -> bool[src]
fn gt(&self, other: &NativeEndian<T>) -> bool[src]
fn ge(&self, other: &NativeEndian<T>) -> bool[src]
impl ReadFrom for NativeEndian<u8>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<i8>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<f32>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<f64>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<u16>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<i16>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<u32>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<i32>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<u64>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<i64>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<u128>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl ReadFrom for NativeEndian<i128>[src]
type Error = Error
What error can happen when trying to read?
fn read_from<R: Read>(inp: R) -> Result<Self, Self::Error>[src]
impl<T> StructuralEq for NativeEndian<T>[src]
impl<T> StructuralPartialEq for NativeEndian<T>[src]
impl WriteTo for NativeEndian<u8>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<i8>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<f32>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<f64>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<u16>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<i16>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<u32>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<i32>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<u64>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<i64>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<u128>[src]
type Error = Error
What error can happen when trying to write?
fn write_to<W: Write>(&self, out: W) -> Result<usize, Self::Error>[src]
impl WriteTo for NativeEndian<i128>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for NativeEndian<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for NativeEndian<T> where
T: Send,
T: Send,
impl<T> Sync for NativeEndian<T> where
T: Sync,
T: Sync,
impl<T> Unpin for NativeEndian<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for NativeEndian<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
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.
pub fn to_owned(&self) -> T[src]
pub 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 = Infallible
The type returned in the event of a conversion error.
pub 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>,