pub trait Application:
Sized
+ Send
+ 'static {
// Required method
fn start(&self) -> impl Future<Output = Result<Pid, ExitReason>> + Send;
// Provided methods
fn config() -> ApplicationConfig { ... }
fn run(self) { ... }
fn test(self) { ... }
}Expand description
Main application logic and entry point for a hydra program.
Application provides graceful shutdown by allowing you to link a process inside the call to start.
The run call will only return once that process has terminated. It’s recommended to link a supervisor.
Required Methods§
Sourcefn start(&self) -> impl Future<Output = Result<Pid, ExitReason>> + Send
fn start(&self) -> impl Future<Output = Result<Pid, ExitReason>> + Send
Called when an application is starting. You should link a process here and return it’s Pid.
The Application will wait for that process to exit before returning from run.
Provided Methods§
Sourcefn config() -> ApplicationConfig
fn config() -> ApplicationConfig
Override to change the application configuration defaults.
Sourcefn run(self)
fn run(self)
Runs the Application to completion.
This method will return when the linked process created in start has exited.
Examples found in repository?
More examples
Sourcefn test(self)
fn test(self)
Runs the Application to completion for tests.
This method will panic if the process doesn’t cleanly exit with normal or shutdown reasons.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.