pub trait HandleStore {
// Required methods
fn intern(&mut self, value: Value) -> HandleId;
fn get(&self, id: &HandleId) -> Option<&Value>;
fn contains(&self, id: &HandleId) -> bool;
fn handle_for_value(&self, value: &Value) -> Option<HandleId>;
}Expand description
Contract for interning runtime Values behind opaque HandleIds.
This is protocol the libraries implement; the kernel ships a default
BTreeHandleStore and defines the handle-id identity, not the lifetime
policy.
Required Methods§
Sourcefn intern(&mut self, value: Value) -> HandleId
fn intern(&mut self, value: Value) -> HandleId
Interns value, returning its handle; equal values reuse one handle.
Sourcefn get(&self, id: &HandleId) -> Option<&Value>
fn get(&self, id: &HandleId) -> Option<&Value>
Resolves the value for id, or None when it is not stored here.
Sourcefn handle_for_value(&self, value: &Value) -> Option<HandleId>
fn handle_for_value(&self, value: &Value) -> Option<HandleId>
Returns the existing handle for value, if one is interned.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".