Skip to main content

HandleStore

Trait HandleStore 

Source
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§

Source

fn intern(&mut self, value: Value) -> HandleId

Interns value, returning its handle; equal values reuse one handle.

Source

fn get(&self, id: &HandleId) -> Option<&Value>

Resolves the value for id, or None when it is not stored here.

Source

fn contains(&self, id: &HandleId) -> bool

Returns whether id is interned in this store.

Source

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".

Implementors§