Skip to main content

RawRepr

Trait RawRepr 

Source
pub trait RawRepr: Sized {
    type Raw: PlainOldData;

    // Required method
    fn to_raw(&self) -> Self::Raw;
}
Expand description

Conversion of a value to its raw, PlainOldData representation.

The “raw representation” is an intermediate type that:

  1. Is PlainOldData (no padding, all bit patterns valid), so it can be safely transmuted.
  2. Encodes any necessary byte-order or layout transformations (e.g. wrapping multi-byte integers in LittleEndian<T> or BigEndian<T>).

For example, u32 has Raw = LittleEndian<u32>, so serializing a u32 always produces little-endian bytes regardless of the host byte order.

This is the write half of the fixed-size serialization pipeline. The read half is TryFromRawRepr (fallible) or FromRawRepr (infallible).

A blanket impl provides RawRepr for [T; N] when T: RawRepr.

Required Associated Types§

Source

type Raw: PlainOldData

The PlainOldData type that Self serializes to.

Required Methods§

Source

fn to_raw(&self) -> Self::Raw

Convert this value to its raw representation for serialization.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RawRepr for Duration

Source§

type Raw = DurationRaw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Ipv4Addr

Source§

type Raw = Ipv4AddrRaw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Ipv6Addr

Source§

type Raw = Ipv6AddrRaw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<i8>

Source§

type Raw = <i8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<i16>

Source§

type Raw = <i16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<i32>

Source§

type Raw = <i32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<i64>

Source§

type Raw = <i64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<i128>

Source§

type Raw = <i128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<u8>

Source§

type Raw = <u8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<u16>

Source§

type Raw = <u16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<u32>

Source§

type Raw = <u32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<u64>

Source§

type Raw = <u64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for NonZero<u128>

Source§

type Raw = <u128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Ordering

Source§

type Raw = u8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<i8>

Source§

type Raw = RangeI8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<i16>

Source§

type Raw = RangeI16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<i32>

Source§

type Raw = RangeI32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<i64>

Source§

type Raw = RangeI64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<i128>

Source§

type Raw = RangeI128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<u8>

Source§

type Raw = RangeU8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<u16>

Source§

type Raw = RangeU16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<u32>

Source§

type Raw = RangeU32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<u64>

Source§

type Raw = RangeU64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Range<u128>

Source§

type Raw = RangeU128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<f32>

Source§

type Raw = RangeFromF32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<f64>

Source§

type Raw = RangeFromF64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<i8>

Source§

type Raw = RangeFromI8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<i16>

Source§

type Raw = RangeFromI16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<i32>

Source§

type Raw = RangeFromI32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<i64>

Source§

type Raw = RangeFromI64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<i128>

Source§

type Raw = RangeFromI128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<u8>

Source§

type Raw = RangeFromU8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<u16>

Source§

type Raw = RangeFromU16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<u32>

Source§

type Raw = RangeFromU32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<u64>

Source§

type Raw = RangeFromU64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFrom<u128>

Source§

type Raw = RangeFromU128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeFull

Source§

type Raw = UnitStructRaw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<i8>

Source§

type Raw = RangeI8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<i16>

Source§

type Raw = RangeI16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<i32>

Source§

type Raw = RangeI32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<i64>

Source§

type Raw = RangeI64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<i128>

Source§

type Raw = RangeI128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<u8>

Source§

type Raw = RangeU8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<u16>

Source§

type Raw = RangeU16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<u32>

Source§

type Raw = RangeU32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<u64>

Source§

type Raw = RangeU64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeInclusive<u128>

Source§

type Raw = RangeU128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<f32>

Source§

type Raw = RangeToF32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<f64>

Source§

type Raw = RangeToF64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<i8>

Source§

type Raw = RangeToI8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<i16>

Source§

type Raw = RangeToI16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<i32>

Source§

type Raw = RangeToI32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<i64>

Source§

type Raw = RangeToI64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<i128>

Source§

type Raw = RangeToI128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<u8>

Source§

type Raw = RangeToU8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<u16>

Source§

type Raw = RangeToU16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<u32>

Source§

type Raw = RangeToU32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<u64>

Source§

type Raw = RangeToU64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeTo<u128>

Source§

type Raw = RangeToU128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<f32>

Source§

type Raw = RangeToInclusiveF32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<f64>

Source§

type Raw = RangeToInclusiveF64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<i8>

Source§

type Raw = RangeToInclusiveI8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<i16>

Source§

type Raw = RangeToInclusiveI16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<i32>

Source§

type Raw = RangeToInclusiveI32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<i64>

Source§

type Raw = RangeToInclusiveI64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<i128>

Source§

type Raw = RangeToInclusiveI128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<u8>

Source§

type Raw = RangeToInclusiveU8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<u16>

Source§

type Raw = RangeToInclusiveU16

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<u32>

Source§

type Raw = RangeToInclusiveU32

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<u64>

Source§

type Raw = RangeToInclusiveU64

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for RangeToInclusive<u128>

Source§

type Raw = RangeToInclusiveU128

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<i8>

Source§

type Raw = <i8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<i16>

Source§

type Raw = <i16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<i32>

Source§

type Raw = <i32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<i64>

Source§

type Raw = <i64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<i128>

Source§

type Raw = <i128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<u8>

Source§

type Raw = <u8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<u16>

Source§

type Raw = <u16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<u32>

Source§

type Raw = <u32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<u64>

Source§

type Raw = <u64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Saturating<u128>

Source§

type Raw = <u128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for SocketAddrV4

Source§

type Raw = SocketAddrV4Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for SocketAddrV6

Source§

type Raw = SocketAddrV6Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for SystemTime

Available on crate feature std only.
Source§

type Raw = SystemTimeRaw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<i8>

Source§

type Raw = <i8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<i16>

Source§

type Raw = <i16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<i32>

Source§

type Raw = <i32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<i64>

Source§

type Raw = <i64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<i128>

Source§

type Raw = <i128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<u8>

Source§

type Raw = <u8 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<u16>

Source§

type Raw = <u16 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<u32>

Source§

type Raw = <u32 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<u64>

Source§

type Raw = <u64 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for Wrapping<u128>

Source§

type Raw = <u128 as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for bool

Source§

type Raw = u8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for char

Source§

type Raw = LittleEndian<u32>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for f32

Source§

type Raw = LittleEndian<f32>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for f64

Source§

type Raw = LittleEndian<f64>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for i8

Source§

type Raw = i8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for i16

Source§

type Raw = LittleEndian<i16>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for i32

Source§

type Raw = LittleEndian<i32>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for i64

Source§

type Raw = LittleEndian<i64>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for i128

Source§

type Raw = LittleEndian<i128>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for u8

Source§

type Raw = u8

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for u16

Source§

type Raw = LittleEndian<u16>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for u32

Source§

type Raw = LittleEndian<u32>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for u64

Source§

type Raw = LittleEndian<u64>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl RawRepr for u128

Source§

type Raw = LittleEndian<u128>

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T: RawRepr, const N: usize> RawRepr for [T; N]

Source§

type Raw = [<T as RawRepr>::Raw; N]

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T: RawRepr> RawRepr for Arc<T>

Source§

type Raw = <T as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T: RawRepr> RawRepr for Box<T>

Source§

type Raw = <T as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T: RawRepr> RawRepr for Rc<T>

Source§

type Raw = <T as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T: RawRepr> RawRepr for Reverse<T>

Source§

type Raw = <T as RawRepr>::Raw

Source§

fn to_raw(&self) -> Self::Raw

Source§

impl<T> RawRepr for PhantomData<T>

Source§

type Raw = UnitStructRaw

Source§

fn to_raw(&self) -> Self::Raw

Implementors§