Trait abscissa::Application [−][src]
pub trait Application: Send + Sized + Sync { type Cmd: Command + LoadConfig<Self::Config>; type Config: GlobalConfig; fn config(&self) -> ConfigReader<Self::Config> { ... } fn name(&self) -> &'static str { ... } fn description(&self) -> &'static str { ... } fn version(&self) -> Version { ... } fn authors(&self) -> Vec<String> { ... } fn bin(&self) -> CanonicalPathBuf { ... } fn color_config(&self, command: &Self::Cmd) -> ColorConfig { ... } fn init(&self, command: &Self::Cmd) -> Result<Components, FrameworkError> { ... } fn components(
&self,
command: &Self::Cmd
) -> Result<Components, FrameworkError> { ... } fn logging_config(&self, command: &Self::Cmd) -> LoggingConfig { ... } fn path(
&self,
path_type: ApplicationPath
) -> Result<CanonicalPathBuf, FrameworkError> { ... } fn register(&self, component: &Component) -> Result<(), FrameworkError> { ... } fn unregister(&self, component: &Component) -> Result<(), FrameworkError> { ... } fn shutdown(&self, components: Components) -> ! { ... } }
Core Abscissa trait used for managing the application lifecycle.
The Application
trait ties together the GlobalConfig
, Options
, and
Error
types for a particular application.
It provides the main framework entrypoint: Application::boot()
, which
will parse command line options and launch a given application.
Associated Types
type Cmd: Command + LoadConfig<Self::Config>
Application (sub)command which serves as the main entry point
type Config: GlobalConfig
Configuration type used by this application
Provided Methods
fn config(&self) -> ConfigReader<Self::Config>
Get a read lock on the application's global configuration
fn name(&self) -> &'static str
Name of this application as a string
fn description(&self) -> &'static str
Description of this application
fn version(&self) -> Version
Version of this application
Authors of this application
fn bin(&self) -> CanonicalPathBuf
Path to this application's binary
fn color_config(&self, command: &Self::Cmd) -> ColorConfig
Color configuration for this application
fn init(&self, command: &Self::Cmd) -> Result<Components, FrameworkError>
Load this application's configuration and initialize its components
fn components(&self, command: &Self::Cmd) -> Result<Components, FrameworkError>
Get this application's components
fn logging_config(&self, command: &Self::Cmd) -> LoggingConfig
Get the logging configuration for this application
fn path(
&self,
path_type: ApplicationPath
) -> Result<CanonicalPathBuf, FrameworkError>
&self,
path_type: ApplicationPath
) -> Result<CanonicalPathBuf, FrameworkError>
Get a path associated with this application
fn register(&self, component: &Component) -> Result<(), FrameworkError>
Register a componen\t with this application. By default do nothing.
fn unregister(&self, component: &Component) -> Result<(), FrameworkError>
Register a component with this application. By default do nothing.
fn shutdown(&self, components: Components) -> !
Shut down this application gracefully, exiting with success