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 get_config<T>(&self, plugin: &impl Configurable) -> Result<T>where
T: DeserializeOwned,
pub fn get_config<T>(&self, plugin: &impl Configurable) -> Result<T>where
T: DeserializeOwned,
Get the configuration items of the plugin according to the plugin’s config_prefix
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<T>(&self) -> Option<Arc<T>>
pub fn get_component<T>(&self) -> Option<Arc<T>>
Get the component of the specified type
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
Trait Implementations§
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