pub trait Encoding: Sealed + 'static {
const NAME: &'static str;
}Expand description
A payload encoding. Only the three marker types of this module implement it.
The trait carries the encoding’s name and nothing else. A payload’s size
in an encoding is Payload<E>::MAX_SIZE on the payload type, and an
interface’s sizes are its table, Sizes<E> in contract.
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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".