fidl::encoding

Trait ValueTypeMarker

Source
pub trait ValueTypeMarker: TypeMarker {
    type Borrowed<'a>;

    // Required method
    fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>;
}
Expand description

A FIDL value type marker.

Value types are guaranteed to never contain handles. As a result, they can be encoded by immutable reference (or by value for Copy types).

Required Associated Types§

Source

type Borrowed<'a>

The Rust type to use for encoding. This is a particular Encode<Self> type cheaply obtainable from &Self::Owned. There are three cases:

  • Special cases such as &[T] for vectors.
  • For primitives, bits, and enums, it is Owned.
  • Otherwise, it is &Owned.

Required Methods§

Source

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Cheaply converts from &Self::Owned to Self::Borrowed.

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 ValueTypeMarker for bool

Source§

type Borrowed<'a> = bool

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for f32

Source§

type Borrowed<'a> = f32

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for f64

Source§

type Borrowed<'a> = f64

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for i8

Source§

type Borrowed<'a> = i8

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for i16

Source§

type Borrowed<'a> = i16

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for i32

Source§

type Borrowed<'a> = i32

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for i64

Source§

type Borrowed<'a> = i64

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for u8

Source§

type Borrowed<'a> = u8

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for u16

Source§

type Borrowed<'a> = u16

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for u32

Source§

type Borrowed<'a> = u32

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Source§

impl ValueTypeMarker for u64

Source§

type Borrowed<'a> = u64

Source§

fn borrow(value: &Self::Owned) -> Self::Borrowed<'_>

Implementors§

Source§

impl ValueTypeMarker for FrameworkErr

Source§

impl ValueTypeMarker for ObjectType

Source§

impl ValueTypeMarker for Rights

Source§

impl ValueTypeMarker for WireMetadata

Source§

impl ValueTypeMarker for Ambiguous1

Source§

impl ValueTypeMarker for Ambiguous2

Source§

impl ValueTypeMarker for EmptyPayload

Source§

type Borrowed<'a> = ()

Source§

impl ValueTypeMarker for EmptyStruct

Source§

type Borrowed<'a> = ()

Source§

impl ValueTypeMarker for EpitaphBody

Source§

impl ValueTypeMarker for TransactionHeader

Source§

impl<T: Timeline + Copy + 'static, U: Copy + 'static> ValueTypeMarker for Instant<T, U>

Source§

type Borrowed<'a> = Instant<T, U>

Source§

impl<T: ValueTypeMarker> ValueTypeMarker for Boxed<T>

Source§

impl<T: ValueTypeMarker> ValueTypeMarker for Optional<T>

Source§

impl<T: ValueTypeMarker> ValueTypeMarker for OptionalUnion<T>

Source§

impl<T: ValueTypeMarker, const N: usize> ValueTypeMarker for Array<T, N>

Source§

type Borrowed<'a> = &'a [<T as TypeMarker>::Owned; N]

Source§

impl<T: ValueTypeMarker, const N: usize> ValueTypeMarker for Vector<T, N>

Source§

type Borrowed<'a> = &'a [<T as TypeMarker>::Owned]

Source§

impl<const N: usize> ValueTypeMarker for BoundedString<N>

Source§

type Borrowed<'a> = &'a str