pub struct AppBuilder { /* private fields */ }
Implementations§
source§impl AppBuilder
impl AppBuilder
sourcepub fn add_plugin<T: Plugin>(&mut self, plugin: T) -> &mut Self
pub fn add_plugin<T: Plugin>(&mut self, plugin: T) -> &mut Self
add plugin
sourcepub fn is_plugin_added<T: Plugin>(&self) -> bool
pub fn is_plugin_added<T: Plugin>(&self) -> bool
Returns true
if the Plugin
has already been added.
sourcepub fn config_file(&mut self, config_path: &str) -> &mut Self
pub fn config_file(&mut self, config_path: &str) -> &mut Self
The path of the configuration file, default is ./config/app.toml
.
The application automatically reads the environment configuration file
in the same directory according to the SPRING_ENV
environment variable,
such as ./config/app-dev.toml
.
The environment configuration file has a higher priority and will
overwrite the configuration items of the main configuration file.
For specific supported environments, see the Env enum.
sourcepub fn add_component<T>(&mut self, component: T) -> &mut Self
pub fn add_component<T>(&mut self, component: T) -> &mut Self
Add component to the registry
sourcepub fn get_component_ref<T>(&self) -> Option<ComponentRef<T>>
pub fn get_component_ref<T>(&self) -> Option<ComponentRef<T>>
Get the component of the specified type
sourcepub fn get_component<T>(&self) -> Option<T>
pub fn get_component<T>(&self) -> Option<T>
get cloned component
sourcepub fn add_scheduler<T>(&mut self, scheduler: T) -> &mut Self
pub fn add_scheduler<T>(&mut self, scheduler: T) -> &mut Self
Add a scheduled task
sourcepub fn add_shutdown_hook<T>(&mut self, hook: T) -> &mut Self
pub fn add_shutdown_hook<T>(&mut self, hook: T) -> &mut Self
Add a shutdown hook
Trait Implementations§
source§impl ConfigRegistry for AppBuilder
impl ConfigRegistry for AppBuilder
source§fn get_config<T>(&self) -> Result<T>where
T: DeserializeOwned + Configurable,
fn get_config<T>(&self) -> Result<T>where
T: DeserializeOwned + Configurable,
Get the configuration items according to the Configurable’s
config_prefix
source§impl Default for AppBuilder
impl Default for AppBuilder
impl Send for AppBuilder
impl Sync for AppBuilder
Auto Trait Implementations§
impl !Freeze for AppBuilder
impl !RefUnwindSafe for AppBuilder
impl Unpin for AppBuilder
impl !UnwindSafe for AppBuilder
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