pub struct ComponentFactory { /* private fields */ }Expand description
Component factory for creating configured instances.
This factory provides a centralized way to create core components with proper configuration injection, ensuring consistent component initialization across the application.
§Examples
use subx_cli::core::ComponentFactory;
use subx_cli::config::ProductionConfigService;
use std::sync::Arc;
let config_service = Arc::new(ProductionConfigService::new()?);
let factory = ComponentFactory::new(config_service.as_ref())?;
// Create components with proper configuration
let detector = factory.create_dialogue_detector();
let match_engine = factory.create_match_engine()?;
let file_manager = factory.create_file_manager();Implementations§
Source§impl ComponentFactory
impl ComponentFactory
Sourcepub fn new(config_service: &dyn ConfigService) -> Result<Self>
pub fn new(config_service: &dyn ConfigService) -> Result<Self>
Sourcepub fn create_dialogue_detector(&self) -> DialogueDetector
pub fn create_dialogue_detector(&self) -> DialogueDetector
Create a dialogue detector with sync configuration.
Returns a properly configured DialogueDetector instance using the sync configuration section.
Sourcepub fn create_match_engine(&self) -> Result<MatchEngine>
pub fn create_match_engine(&self) -> Result<MatchEngine>
Create a match engine with AI configuration.
Returns a properly configured MatchEngine instance using the AI configuration section.
§Errors
Returns an error if AI provider creation fails.
Sourcepub fn create_file_manager(&self) -> FileManager
pub fn create_file_manager(&self) -> FileManager
Create a file manager with general configuration.
Returns a properly configured FileManager instance using the general configuration section.
Sourcepub fn create_ai_provider(&self) -> Result<Box<dyn AIProvider>>
pub fn create_ai_provider(&self) -> Result<Box<dyn AIProvider>>
Create an AI provider with AI configuration.
Returns a properly configured AI provider instance based on the provider type specified in the AI configuration.
§Errors
Returns an error if the provider type is unsupported or provider creation fails.
Auto Trait Implementations§
impl Freeze for ComponentFactory
impl RefUnwindSafe for ComponentFactory
impl Send for ComponentFactory
impl Sync for ComponentFactory
impl Unpin for ComponentFactory
impl UnwindSafe for ComponentFactory
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.