Skip to main content

Encoding

Trait Encoding 

Source
pub trait Encoding: Sealed + 'static {
    const NAME: &'static str;
}
Expand description

A payload encoding. Only the three marker types of this module implement it.

A crate outside ridl-rt names an encoding through this trait:

fn name<E: ridl_rt::encoding::Encoding>() -> &'static str {
    E::NAME
}
assert_eq!(name::<ridl_rt::encoding::ReprC>(), "repr-c");

and cannot add an encoding:

ⓘ
struct Json;

impl ridl_rt::encoding::Encoding for Json {
    const NAME: &'static str = "json";
}

and cannot implement the sealing trait, because its module is private:

ⓘ
struct Json;

impl ridl_rt::encoding::sealed::Sealed for Json {}

Required Associated Constants§

Source

const NAME: &'static str

The encoding’s name, spelled as its cargo feature is spelled.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Encoding for FlatBuffers

Source§

const NAME: &'static str = "flatbuffers"

Source§

impl Encoding for Proto3

Source§

const NAME: &'static str = "proto3"

Source§

impl Encoding for ReprC

Source§

const NAME: &'static str = "repr-c"