Encode

Trait Encode 

Source
pub unsafe trait Encode<W, E>: Sized
where W: Constrained, E: ?Sized,
{ const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _; // Required method fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>; }
Expand description

Encodes a value.

§Safety

encode must initialize all non-padding bytes of out.

Provided Associated Constants§

Source

const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _

Whether the conversion from Self to W is equivalent to copying the raw bytes of Self.

Copy optimization is disabled by default.

Required Methods§

Source

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Encodes this value into an encoder and output.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, E> Encode<bool, E> for &'a bool
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<bool>, _constraint: <bool as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<i8, E> for &'a i8
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<i8>, _constraint: <i8 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<u8, E> for &'a u8
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<u8>, _constraint: <u8 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<(), E> for &'a ()
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<()>, _constraint: <() as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireF32, E> for &'a f32
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireF32>, _constraint: <WireF32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireF64, E> for &'a f64
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireF64>, _constraint: <WireF64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireI16, E> for &'a i16
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireI16>, _constraint: <WireI16 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireI32, E> for &'a i32
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireI32>, _constraint: <WireI32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireI64, E> for &'a i64
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireI64>, _constraint: <WireI64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireU16, E> for &'a u16
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireU16>, _constraint: <WireU16 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireU32, E> for &'a u32
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireU32>, _constraint: <WireU32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, E> Encode<WireU64, E> for &'a u64
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireU64>, _constraint: <WireU64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, Enc, WT, T, WE, E> Encode<WireResult<'static, WT, WE>, Enc> for &'a Result<T, E>
where Enc: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, &'a T: Encode<WT, Enc>, WE: Constrained<Constraint = ()> + Wire, &'a E: Encode<WE, Enc>,

Source§

fn encode( self, encoder: &mut Enc, out: &mut MaybeUninit<WireResult<'static, WT, WE>>, _: (), ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T> Encode<WireVector<'static, W>, E> for &'a [T]
where W: Constrained + Wire, E: Encoder + ?Sized, T: Encode<W, E>, &'a T: Encode<W, E>,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireVector<'static, W>>, constraint: (u64, <W as Constrained>::Constraint), ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T> Encode<WireVector<'static, W>, E> for &'a Vec<T>
where W: Constrained + Wire, E: Encoder + ?Sized, T: Encode<W, E>, &'a T: Encode<W, E>,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireVector<'static, W>>, constraint: (u64, <W as Constrained>::Constraint), ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T> Encode<W, E> for &'a Option<T>
where W: Constrained, Option<&'a T>: Encode<W, E>, E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T> Encode<W, E> for &'a Box<T>
where W: Constrained, &'a T: Encode<W, E>, E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T, const N: usize> Encode<[W; N], E> for &'a [T; N]
where W: Constrained, T: Encode<W, E>, &'a T: Encode<W, E>, E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<[W; N]>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<'a, W, E, T, const N: usize> Encode<WireVector<'static, W>, E> for &'a [T; N]
where W: Constrained + Wire, E: Encoder + ?Sized, T: Encode<W, E>, &'a T: Encode<W, E>,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireVector<'static, W>>, constraint: (u64, <W as Constrained>::Constraint), ) -> Result<(), EncodeError>

Source§

impl<E> Encode<bool, E> for bool
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<bool, bool> = CopyOptimization<bool, bool>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<bool>, constraint: <bool as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<i8, E> for i8
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<i8, i8> = CopyOptimization<i8, i8>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<i8>, constraint: <i8 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<u8, E> for u8
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<u8, u8> = CopyOptimization<u8, u8>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<u8>, constraint: <u8 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<(), E> for ()
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<(), ()> = CopyOptimization<(), ()>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<()>, constraint: <() as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireEpitaph, E> for &WireEpitaph
where E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireEpitaph>, constraint: (), ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireEpitaph, E> for WireEpitaph
where E: ?Sized,

Source§

fn encode( self, _: &mut E, out: &mut MaybeUninit<WireEpitaph>, _: (), ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireMessageHeader, E> for &WireMessageHeader
where E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireMessageHeader>, constraint: (), ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireMessageHeader, E> for WireMessageHeader
where E: ?Sized,

Source§

impl<E> Encode<WireF32, E> for f32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<f32, WireF32> = CopyOptimization<f32, WireF32>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireF32>, constraint: <WireF32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireF64, E> for f64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<f64, WireF64> = CopyOptimization<f64, WireF64>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireF64>, constraint: <WireF64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireI16, E> for i16
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<i16, WireI16> = CopyOptimization<i16, WireI16>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireI16>, constraint: <WireI16 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireI32, E> for i32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<i32, WireI32> = CopyOptimization<i32, WireI32>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireI32>, constraint: <WireI32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireI64, E> for i64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<i64, WireI64> = CopyOptimization<i64, WireI64>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireI64>, constraint: <WireI64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireString<'static>, E> for &str
where E: Encoder + ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireString<'static>>, _constraint: u64, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireString<'static>, E> for &String
where E: Encoder + ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireString<'static>>, constraint: u64, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireString<'static>, E> for String
where E: Encoder + ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireString<'static>>, constraint: u64, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireU16, E> for u16
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<u16, WireU16> = CopyOptimization<u16, WireU16>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireU16>, constraint: <WireU16 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireU32, E> for u32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<u32, WireU32> = CopyOptimization<u32, WireU32>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireU32>, constraint: <WireU32 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<E> Encode<WireU64, E> for u64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<u64, WireU64> = CopyOptimization<u64, WireU64>::PRIMITIVE

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireU64>, constraint: <WireU64 as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<Enc, WT, T, WE, E> Encode<WireResult<'static, WT, WE>, Enc> for Result<T, E>
where Enc: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, T: Encode<WT, Enc>, WE: Constrained<Constraint = ()> + Wire, E: Encode<WE, Enc>,

Source§

fn encode( self, encoder: &mut Enc, out: &mut MaybeUninit<WireResult<'static, WT, WE>>, _: (), ) -> Result<(), EncodeError>

Source§

impl<W, E, T> Encode<WireVector<'static, W>, E> for Vec<T>
where W: Constrained + Wire, E: Encoder + ?Sized, T: Encode<W, E>,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireVector<'static, W>>, constraint: (u64, <W as Constrained>::Constraint), ) -> Result<(), EncodeError>

Source§

impl<W, E, T> Encode<W, E> for Option<T>
where W: Constrained, T: EncodeOption<W, E>, E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<W, E, T> Encode<W, E> for Box<T>
where W: Constrained, T: Encode<W, E>, E: ?Sized,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<W>, constraint: <W as Constrained>::Constraint, ) -> Result<(), EncodeError>

Source§

impl<W, E, T, const N: usize> Encode<[W; N], E> for [T; N]
where W: Constrained, T: Encode<W, E>, E: ?Sized,

Source§

impl<W, E, T, const N: usize> Encode<WireVector<'static, W>, E> for [T; N]
where W: Constrained + Wire, E: Encoder + ?Sized, T: Encode<W, E>,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireVector<'static, W>>, constraint: (u64, <W as Constrained>::Constraint), ) -> Result<(), EncodeError>

Implementors§

Source§

impl<'a, E> Encode<WireF32, E> for &'a WireF32
where E: ?Sized,

Source§

impl<'a, E> Encode<WireF64, E> for &'a WireF64
where E: ?Sized,

Source§

impl<'a, E> Encode<WireI16, E> for &'a WireI16
where E: ?Sized,

Source§

impl<'a, E> Encode<WireI32, E> for &'a WireI32
where E: ?Sized,

Source§

impl<'a, E> Encode<WireI64, E> for &'a WireI64
where E: ?Sized,

Source§

impl<'a, E> Encode<WireU16, E> for &'a WireU16
where E: ?Sized,

Source§

impl<'a, E> Encode<WireU32, E> for &'a WireU32
where E: ?Sized,

Source§

impl<'a, E> Encode<WireU64, E> for &'a WireU64
where E: ?Sized,

Source§

impl<'a, E, WT, T> Encode<WireFlexible<'static, WT>, E> for &'a Flexible<T>
where E: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, &'a T: Encode<WT, E>,

Source§

impl<'a, Enc, WT, T, WE, E> Encode<WireFlexibleResult<'static, WT, WE>, Enc> for &'a FlexibleResult<T, E>
where Enc: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, &'a T: Encode<WT, Enc>, WE: Constrained<Constraint = ()> + Wire, &'a E: Encode<WE, Enc>,

Source§

impl<'a, W, E, P, T> Encode<ClientEnd<P, W>, E> for &'a ClientEnd<P, T>
where P: 'static, &'a T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire, E: ?Sized,

Source§

impl<'a, W, E, P, T> Encode<ServerEnd<P, W>, E> for &'a ServerEnd<P, T>
where P: 'static, &'a T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire, E: ?Sized,

Source§

impl<E> Encode<WireBti, E> for Bti
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireChannel, E> for Channel
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireClock, E> for Clock
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireCounter, E> for Counter
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireDebugLog, E> for DebugLog
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireEvent, E> for Event
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireEventPair, E> for EventPair
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireException, E> for Exception
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireFifo, E> for Fifo
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireGuest, E> for Guest
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireInterrupt, E> for Interrupt
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireIob, E> for Iob
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireIommu, E> for Iommu
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireJob, E> for Job
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireObjectType, E> for &ObjectType
where E: ?Sized,

Source§

impl<E> Encode<WireObjectType, E> for ObjectType
where E: ?Sized,

Source§

impl<E> Encode<WirePager, E> for Pager
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WirePmt, E> for Pmt
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WirePort, E> for Port
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireProcess, E> for Process
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireProfile, E> for Profile
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireResource, E> for Resource
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireRights, E> for &Rights
where E: ?Sized,

Source§

impl<E> Encode<WireRights, E> for Rights
where E: ?Sized,

Source§

impl<E> Encode<WireSocket, E> for Socket
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireStream, E> for Stream
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireThread, E> for Thread
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireTimer, E> for Timer
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireVcpu, E> for Vcpu
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireVmar, E> for Vmar
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireVmo, E> for Vmo
where E: HandleEncoder + ?Sized,

Source§

impl<E> Encode<WireF32, E> for WireF32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireF32, WireF32> = CopyOptimization<WireF32, WireF32>::PRIMITIVE

Source§

impl<E> Encode<WireF64, E> for WireF64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireF64, WireF64> = CopyOptimization<WireF64, WireF64>::PRIMITIVE

Source§

impl<E> Encode<WireFrameworkError, E> for &FrameworkError
where E: ?Sized,

Source§

impl<E> Encode<WireFrameworkError, E> for FrameworkError
where E: ?Sized,

Source§

impl<E> Encode<WireI16, E> for WireI16
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireI16, WireI16> = CopyOptimization<WireI16, WireI16>::PRIMITIVE

Source§

impl<E> Encode<WireI32, E> for WireI32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireI32, WireI32> = CopyOptimization<WireI32, WireI32>::PRIMITIVE

Source§

impl<E> Encode<WireI64, E> for WireI64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireI64, WireI64> = CopyOptimization<WireI64, WireI64>::PRIMITIVE

Source§

impl<E> Encode<WireU16, E> for WireU16
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireU16, WireU16> = CopyOptimization<WireU16, WireU16>::PRIMITIVE

Source§

impl<E> Encode<WireU32, E> for WireU32
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireU32, WireU32> = CopyOptimization<WireU32, WireU32>::PRIMITIVE

Source§

impl<E> Encode<WireU64, E> for WireU64
where E: ?Sized,

Source§

const COPY_OPTIMIZATION: CopyOptimization<WireU64, WireU64> = CopyOptimization<WireU64, WireU64>::PRIMITIVE

Source§

impl<E> Encode<WireHandle, E> for Handle
where E: HandleEncoder + ?Sized,

Source§

impl<E, WT, T> Encode<WireFlexible<'static, WT>, E> for Flexible<T>
where E: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, T: Encode<WT, E>,

Source§

impl<Enc, WT, T, WE, E> Encode<WireFlexibleResult<'static, WT, WE>, Enc> for FlexibleResult<T, E>
where Enc: Encoder + ?Sized, WT: Constrained<Constraint = ()> + Wire, T: Encode<WT, Enc>, WE: Constrained<Constraint = ()> + Wire, E: Encode<WE, Enc>,

Source§

impl<W, E> Encode<W, E> for Never
where W: Constrained, E: ?Sized,

Source§

impl<W, E, P, T> Encode<ClientEnd<P, W>, E> for ClientEnd<P, T>
where P: 'static, T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire, E: ?Sized,

Source§

impl<W, E, P, T> Encode<ServerEnd<P, W>, E> for ServerEnd<P, T>
where P: 'static, T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire, E: ?Sized,