16 releases
0.5.7 | Jul 30, 2022 |
---|---|
0.5.5 | Apr 13, 2022 |
0.5.4 | Oct 21, 2021 |
0.5.2 | Oct 15, 2020 |
0.1.0 | Jul 24, 2020 |
#1968 in Web programming
30 downloads per month
Used in 5 crates
16KB
429 lines
gato-core
This repo contains all generics needed to build a modular framework in rust.
Service Provider
Is a trait responsible to modularize the framework, you can register customs ServiceProviders that will be executed during the framework bootstrap, at this moment you can register new drivers or configure the environment, etc.
See SimpleRouter for example:
use crate::SimpleRouter;
use gato_core::kernel::Provider;
use gato_core::kernel::RouterHandler;
pub struct SimpleRouterServiceProvider { }
impl SimpleRouterServiceProvider {
pub fn new() -> Box<Self> { Box::new(SimpleRouterServiceProvider {}) }
}
impl Provider for SimpleRouterServiceProvider {
// This method is executed during boot only one time
fn boot(&self) -> () {
// Register the Router driver
RouterHandler::set_driver(Box::new(SimpleRouter::new()));
}
}
Dependencies
~1.7–2.8MB
~52K SLoC