pub struct FilterLibrary { /* private fields */ }Expand description
Unified registry of filter implementations, metadata, and trained states.
ⓘ
let mut lib = FilterLibrary::new();
lib.register("scaler", Box::new(MyScaler { scale: 2.0 }));
lib.register("model", Box::new(MyModel::default()));
// Use as compiler registry
let result = somatize_compiler::compile(&graph, &lib, mode, cache)?;
// Use directly with executor — no conversion needed
executor::execute(&plan, &mut ctx, &lib, &cache)?;Implementations§
Source§impl FilterLibrary
impl FilterLibrary
Sourcepub fn with_state_store(states: Arc<dyn StateStore>) -> Self
pub fn with_state_store(states: Arc<dyn StateStore>) -> Self
Create a library with a custom StateStore backend.
Sourcepub fn register(&mut self, node_id: impl Into<String>, filter: Box<dyn Filter>)
pub fn register(&mut self, node_id: impl Into<String>, filter: Box<dyn Filter>)
Register a filter for a given node ID.
Sourcepub fn set_state(&self, node_id: impl Into<String>, state: Value)
pub fn set_state(&self, node_id: impl Into<String>, state: Value)
Store a trained state for a node.
Errors bubble up from the underlying StateStore (e.g. I/O on
a disk-backed backend). The in-memory default never fails.
Sourcepub fn get_state(&self, node_id: &str) -> Option<Arc<Value>>
pub fn get_state(&self, node_id: &str) -> Option<Arc<Value>>
Retrieve the trained state for a node. The returned Arc<Value>
can be dereferenced (&*arc) for the forward hot path without
cloning the underlying value.
Sourcepub fn clear_states(&self)
pub fn clear_states(&self)
Drop all stored states (but keep filters).
Sourcepub fn state_store(&self) -> &Arc<dyn StateStore>
pub fn state_store(&self) -> &Arc<dyn StateStore>
Access the underlying StateStore (e.g. to share it across
sessions or inspect its contents).
Trait Implementations§
Source§impl Default for FilterLibrary
impl Default for FilterLibrary
Source§impl FilterRegistry for FilterLibrary
Implements FilterRegistry so the compiler can read metadata
directly from the registered filter implementations.
impl FilterRegistry for FilterLibrary
Implements FilterRegistry so the compiler can read metadata
directly from the registered filter implementations.
Auto Trait Implementations§
impl Freeze for FilterLibrary
impl !RefUnwindSafe for FilterLibrary
impl Send for FilterLibrary
impl Sync for FilterLibrary
impl Unpin for FilterLibrary
impl UnsafeUnpin for FilterLibrary
impl !UnwindSafe for FilterLibrary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more