pub struct IndicatorRegistry { /* private fields */ }Expand description
Runtime registry mapping indicator names to their factory functions.
Analogous to IndicatorRegistry._indicators: dict[str, type[Indicator]]
in Python.
Implementations§
Source§impl IndicatorRegistry
impl IndicatorRegistry
pub fn new_uninit() -> Self
Sourcepub fn register(&self, name: &str, factory: IndicatorFactory)
pub fn register(&self, name: &str, factory: IndicatorFactory)
Register an indicator factory under name (lowercased).
Mirrors IndicatorRegistry.register(indicator_cls).
Sourcepub fn list(&self) -> Vec<String>
pub fn list(&self) -> Vec<String>
List all registered indicator names.
Mirrors IndicatorRegistry.list() -> list[str].
Sourcepub fn get(&self, name: &str) -> Option<IndicatorFactory>
pub fn get(&self, name: &str) -> Option<IndicatorFactory>
Look up a factory by name (case-insensitive).
Mirrors IndicatorRegistry.get(name).
Sourcepub fn create(
&self,
name: &str,
params: &HashMap<String, String>,
) -> Result<Box<dyn Indicator>, IndicatorError>
pub fn create( &self, name: &str, params: &HashMap<String, String>, ) -> Result<Box<dyn Indicator>, IndicatorError>
Create an indicator instance by name.
Mirrors IndicatorRegistry.create(name, **params) and
IndicatorFactory.create(name, **params).
§Errors
IndicatorError::UnknownIndicatorifnameis not registered.- Propagates construction errors from the factory.
Auto Trait Implementations§
impl !Freeze for IndicatorRegistry
impl RefUnwindSafe for IndicatorRegistry
impl Send for IndicatorRegistry
impl Sync for IndicatorRegistry
impl Unpin for IndicatorRegistry
impl UnsafeUnpin for IndicatorRegistry
impl UnwindSafe for IndicatorRegistry
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