pub struct FunctionRegistry { /* private fields */ }Implementations§
Source§impl FunctionRegistry
impl FunctionRegistry
pub fn new() -> Self
Sourcepub fn register<F>(&mut self, name: impl Into<String>, func: F)where
F: FilterFunction + 'static,
pub fn register<F>(&mut self, name: impl Into<String>, func: F)where
F: FilterFunction + 'static,
Register a function and assign it a unique ID if not already present.
Sourcepub fn register_fn<F>(&mut self, name: impl Into<String>, func: F)
pub fn register_fn<F>(&mut self, name: impl Into<String>, func: F)
Register a closure as a filter function.
Sourcepub fn function_id(&self, name: &str) -> Option<usize>
pub fn function_id(&self, name: &str) -> Option<usize>
Get the function ID for a given function name, if it exists.
Sourcepub fn function_name(&self, id: usize) -> Option<&str>
pub fn function_name(&self, id: usize) -> Option<&str>
Get the function name for a given function ID, if it exists.
Sourcepub fn num_functions(&self) -> usize
pub fn num_functions(&self) -> usize
Get the total number of functions.
pub fn get(&self, name: &str) -> Option<&Arc<dyn FilterFunction>>
Trait Implementations§
Source§impl Clone for FunctionRegistry
impl Clone for FunctionRegistry
Source§impl Default for FunctionRegistry
impl Default for FunctionRegistry
Source§fn default() -> FunctionRegistry
fn default() -> FunctionRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FunctionRegistry
impl !RefUnwindSafe for FunctionRegistry
impl Send for FunctionRegistry
impl Sync for FunctionRegistry
impl Unpin for FunctionRegistry
impl !UnwindSafe for FunctionRegistry
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