pub trait Component {
// Provided methods
fn router() -> Router<ServerState> { ... }
fn initialize(_: &ServerState) -> impl Future<Output = Result<()>> + Send { ... }
fn run(
_state: ServerState,
_cancellation_token: CancellationToken,
) -> impl Future<Output = Result<()>> + Send { ... }
}Expand description
Represents a component in the microservice
Provided Methods§
Sourcefn router() -> Router<ServerState>
fn router() -> Router<ServerState>
Returns all the routes exposed by this component.
Sourcefn initialize(_: &ServerState) -> impl Future<Output = Result<()>> + Send
fn initialize(_: &ServerState) -> impl Future<Output = Result<()>> + Send
Hook to run necessary setup tasks for this component.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".