pub struct App { /* private fields */ }Expand description
Main application structure with dependency injection support.
This struct provides the new dependency injection-based architecture for the SubX application, allowing for better testability and configuration management.
Implementations§
Source§impl App
impl App
Sourcepub fn new(config_service: Arc<dyn ConfigService>) -> Self
pub fn new(config_service: Arc<dyn ConfigService>) -> Self
Create a new application instance with the provided configuration service.
§Arguments
config_service- The configuration service to use
Sourcepub fn new_with_production_config() -> Result<Self>
pub fn new_with_production_config() -> Result<Self>
Create a new application instance with the production configuration service.
This is the default way to create an application instance for production use.
§Errors
Returns an error if the production configuration service cannot be created.
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Run the application with command-line argument parsing.
This method parses command-line arguments and executes the appropriate command with the configured dependencies.
§Errors
Returns an error if command execution fails.
Sourcepub async fn handle_command(&self, command: Commands) -> Result<()>
pub async fn handle_command(&self, command: Commands) -> Result<()>
Sourcepub fn config_service(&self) -> &Arc<dyn ConfigService>
pub fn config_service(&self) -> &Arc<dyn ConfigService>
Get a reference to the configuration service.
This allows access to the configuration service for testing or advanced use cases.
Sourcepub fn get_config(&self) -> Result<Config>
pub fn get_config(&self) -> Result<Config>
Get the current configuration.
This is a convenience method that retrieves the configuration from the configured service.
§Errors
Returns an error if configuration loading fails.
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl !UnwindSafe for App
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.