pub trait EnvKey: Copy + 'static {
type Value: Clone + Send + 'static;
// Required methods
fn field_type() -> &'static [u8] ⓘ;
fn value_type() -> &'static [u8] ⓘ;
fn key_path() -> u64;
fn buffer_bytes() -> usize;
unsafe fn decode(buf: &[u8]) -> Self::Value;
fn encode(value: &Self::Value) -> u8;
}Expand description
One \EnvironmentValues property, as a type.
Each implementation names a property and says how to read its value back. Adding another is three resolve entries and one impl.
Required Associated Types§
Required Methods§
Sourcefn field_type() -> &'static [u8] ⓘ
fn field_type() -> &'static [u8] ⓘ
The mangled Environment<Value>, NUL-terminated, for the field record.
Sourcefn value_type() -> &'static [u8] ⓘ
fn value_type() -> &'static [u8] ⓘ
The mangled Value on its own.
field_type is what the reflection record needs; this is what a
modifier generic over V needs, and the two are different manglings of
different types.
Sourcefn buffer_bytes() -> usize
fn buffer_bytes() -> usize
How many bytes the getter writes.
Sourcefn encode(value: &Self::Value) -> u8
fn encode(value: &Self::Value) -> u8
The tag a Value is stored as — decode’s inverse.
Reading the environment only ever needed one direction. Writing one —
transformEnvironment hands a handler the current value and stores
whatever it returns — needs the other, and a key that can do one but
not the other is half a key.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".