pub trait ServiceProvider:
Send
+ Sync
+ 'static {
// Provided methods
fn name(&self) -> &'static str { ... }
fn register(&self, app: &Application) -> Result<(), Error> { ... }
fn boot<'a>(
&'a self,
app: &'a Application,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... }
}Expand description
A bundle of related bindings and their boot-time wiring.
struct Clock;
struct ClockProvider;
impl ServiceProvider for ClockProvider {
fn register(&self, app: &Application) -> Result<()> {
app.singleton(|_: &Container| Ok(Clock));
Ok(())
}
}Provided Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
A label for diagnostics and provider:list. Defaults to the Rust type
name.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".