Skip to main content

Encode

Trait Encode 

Source
pub unsafe trait Encode<W, E>: Sized
where W: Wire, 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, Enc, WT, T, WE, E> Encode<Result<'static, WT, WE>, Enc> for &'a Result<T, E>
where Enc: Encoder + ?Sized, WT: Wire<Constraint = ()>, &'a T: Encode<WT, Enc>, WE: Wire<Constraint = ()>, &'a E: Encode<WE, Enc>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<Vector<'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: Wire, 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: Wire, &'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: Wire, 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<Vector<'static, W>, E> for &'a [T; N]
where W: Wire, E: Encoder + ?Sized, T: Encode<W, E>, &'a T: Encode<W, E>,

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<bool, bool> = crate::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§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<i8, i8> = crate::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§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<u8, u8> = crate::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§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<f32, Float32> = crate::CopyOptimization<f32, Float32>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<f64, Float64> = crate::CopyOptimization<f64, Float64>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<i16, Int16> = crate::CopyOptimization<i16, Int16>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<i32, Int32> = crate::CopyOptimization<i32, Int32>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<i64, Int64> = crate::CopyOptimization<i64, Int64>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<u16, Uint16> = crate::CopyOptimization<u16, Uint16>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<u32, Uint32> = crate::CopyOptimization<u32, Uint32>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<u64, Uint64> = crate::CopyOptimization<u64, Uint64>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<W, E, T> Encode<W, E> for Option<T>
where W: Wire, 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: Wire, 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: Wire, T: Encode<W, E>, E: ?Sized,

Source§

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

Source§

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

Implementors§

Source§

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

Source§

impl<'a, Enc, WT, T, WE, E> Encode<FlexibleResult<'static, WT, WE>, Enc> for &'a FlexibleResult<T, E>
where Enc: Encoder + ?Sized, WT: Wire<Constraint = ()>, &'a T: Encode<WT, Enc>, WE: Wire<Constraint = ()>, &'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: Wire<Constraint = ()>, 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: Wire<Constraint = ()>, E: ?Sized,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Float32, Float32> = crate::CopyOptimization<Float32, Float32>::PRIMITIVE

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Float64, Float64> = crate::CopyOptimization<Float64, Float64>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Int16, Int16> = crate::CopyOptimization<Int16, Int16>::PRIMITIVE

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Int32, Int32> = crate::CopyOptimization<Int32, Int32>::PRIMITIVE

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Int64, Int64> = crate::CopyOptimization<Int64, Int64>::PRIMITIVE

Source§

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

Source§

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

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Uint16, Uint16> = crate::CopyOptimization<Uint16, Uint16>::PRIMITIVE

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Uint32, Uint32> = crate::CopyOptimization<Uint32, Uint32>::PRIMITIVE

Source§

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

Source§

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

Source§

const COPY_OPTIMIZATION: CopyOptimization<Uint64, Uint64> = crate::CopyOptimization<Uint64, Uint64>::PRIMITIVE

Source§

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

Source§

impl<E, K, T> Encode<Interrupt, E> for Interrupt<K, T>

Source§

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

Source§

impl<E, Reference, Output> Encode<Clock, E> for Clock<Reference, Output>
where E: HandleEncoder + ?Sized, Reference: Timeline, Output: Timeline,

Source§

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

Source§

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

Source§

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

Source§

impl<W, E> Encode<W, E> for Never
where W: Wire, 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: Wire<Constraint = ()>, 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: Wire<Constraint = ()>, E: ?Sized,