Skip to main content

RuntimeKeyPolicy

Trait RuntimeKeyPolicy 

Source
pub trait RuntimeKeyPolicy: Send + Sync {
    // Required method
    fn key_for(&self, cx: &mut Cx, value: &Value) -> Result<Option<RuntimeKey>>;
}
Expand description

Maps a language value to a runtime table key.

Returning None means the language forbids that value as a key. For example, a policy can reject nil, NaN, or any object kind it cannot identify.

Required Methods§

Source

fn key_for(&self, cx: &mut Cx, value: &Value) -> Result<Option<RuntimeKey>>

Returns the runtime key for value, or None when the key is forbidden.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§