wasmtime_wasi_nn/registry/mod.rs
1//! Define the registry API.
2//!
3//! A [`GraphRegistry`] is place to store backend graphs so they can be loaded
4//! by name. This API does not mandate how a graph is loaded or how it must be
5//! stored--it could be stored remotely and rematerialized when needed, e.g. A
6//! naive in-memory implementation, [`InMemoryRegistry`] is provided for use
7//! with the Wasmtime CLI.
8
9mod in_memory;
10
11use crate::Graph;
12pub use in_memory::InMemoryRegistry;
13
14pub trait GraphRegistry: Send + Sync {
15 fn get(&self, name: &str) -> Option<&Graph>;
16 fn get_mut(&mut self, name: &str) -> Option<&mut Graph>;
17}