Skip to main content

Envelope

Union Envelope 

Source
pub union Envelope {
    /* private fields */
}
Expand description

A FIDL envelope

Implementations§

Source§

impl Envelope

Source

pub fn encode_zero(out: &mut MaybeUninit<Self>)

Encodes a zero envelope into a slot.

Source

pub fn encode_value_static<W: Wire, E: InternalHandleEncoder + ?Sized>( value: impl Encode<W, E>, encoder: &mut E, out: &mut MaybeUninit<Self>, constraint: W::Constraint, ) -> Result<(), EncodeError>

Encodes a 'static value into an envelope with an encoder.

Source

pub fn encode_value<W: Wire, E: Encoder + ?Sized>( value: impl Encode<W, E>, encoder: &mut E, out: &mut MaybeUninit<Self>, constraint: W::Constraint, ) -> Result<(), EncodeError>

Encodes a value into an envelope with an encoder.

Source

pub fn zero() -> Self

Returns the zero envelope.

Source

pub fn is_encoded_zero(slot: Slot<'_, Self>) -> bool

Returns whether a envelope slot is encoded as zero.

Source

pub fn is_zero(&self) -> bool

Returns whether an envelope is zero.

Source

pub fn decode_unknown_static<D: InternalHandleDecoder + ?Sized>( slot: Slot<'_, Self>, decoder: &mut D, ) -> Result<(), DecodeError>

Decodes and discards a static type in an envelope.

Source

pub fn decode_unknown<'de, D: Decoder<'de> + ?Sized>( slot: Slot<'_, Self>, decoder: &mut D, ) -> Result<(), DecodeError>

Decodes and discards an unknown value in an envelope.

Source

pub fn decode_as_static<D: InternalHandleDecoder + ?Sized, T: Decode<D>>( slot: Slot<'_, Self>, decoder: &mut D, constraint: T::Constraint, ) -> Result<(), DecodeError>

Decodes a value of a known type from an envelope.

Source

pub fn decode_as<'de, D: Decoder<'de> + ?Sized, T: Decode<D>>( slot: Slot<'_, Self>, decoder: &mut D, constraint: T::Constraint, ) -> Result<(), DecodeError>

Decodes a value of a known type from an envelope.

Source

pub unsafe fn as_ptr<T>(this: *mut Self) -> *mut T

Returns a pointer to the value contained in the envelope.

§Safety

this must point to a valid envelope that was successfully decoded.

Source

pub unsafe fn deref_unchecked<T>(&self) -> &T

Returns a reference to the contained T.

§Safety

The envelope must have been successfully decoded as a T.

Source

pub unsafe fn read_unchecked<T>(&self) -> T

Returns the contained T.

§Safety

The envelope must have been successfully decoded as a T. Reading from an envelope can cause undefined behavior if the underlying value is dropped later. Precautions should be taken to ensure that values read from an envelope are not dropped twice.

Source

pub unsafe fn take_unchecked<T>(&mut self) -> T

Takes the contained T out of the envelope.

§Safety

The envelope must have been successfully decoded as a T.

Source

pub unsafe fn clone_inline_unchecked<T: Clone>(&self) -> Self

Clones the envelope, assuming that it contains an inline T.

§Safety

The envelope must have been successfully decoded inline as a T.

Trait Implementations§

Source§

impl Constrained for Envelope

Source§

type Constraint = ()

Type of constraint information for this type.
Source§

fn validate( _: Slot<'_, Self>, _: Self::Constraint, ) -> Result<(), ValidationError>

Validate a slot of this type against a constraint. Can be called when pointers/envelopes are just presence markers.
Source§

impl Wire for Envelope

Source§

type Narrowed<'de> = Envelope

The narrowed wire type, restricted to the 'de lifetime.
Source§

fn zero_padding(_: &mut MaybeUninit<Self>)

Writes zeroes to the padding for this type, if any.
Source§

impl Send for Envelope

Source§

impl Sync for Envelope

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.