You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-07 17:03:01 +03:00
Box the CLI command futures to reduce the size of the try_main future
This commit is contained in:
@@ -69,16 +69,18 @@ pub struct Options {
|
|||||||
impl Options {
|
impl Options {
|
||||||
pub async fn run(self, figment: &Figment) -> anyhow::Result<()> {
|
pub async fn run(self, figment: &Figment) -> anyhow::Result<()> {
|
||||||
use Subcommand as S;
|
use Subcommand as S;
|
||||||
|
// We Box the futures for each subcommand so that we avoid this function being
|
||||||
|
// big on the stack all the time
|
||||||
match self.subcommand {
|
match self.subcommand {
|
||||||
Some(S::Config(c)) => c.run(figment).await,
|
Some(S::Config(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Database(c)) => c.run(figment).await,
|
Some(S::Database(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Server(c)) => c.run(figment).await,
|
Some(S::Server(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Worker(c)) => c.run(figment).await,
|
Some(S::Worker(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Manage(c)) => c.run(figment).await,
|
Some(S::Manage(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Templates(c)) => c.run(figment).await,
|
Some(S::Templates(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Debug(c)) => c.run(figment).await,
|
Some(S::Debug(c)) => Box::pin(c.run(figment)).await,
|
||||||
Some(S::Doctor(c)) => c.run(figment).await,
|
Some(S::Doctor(c)) => Box::pin(c.run(figment)).await,
|
||||||
None => self::server::Options::default().run(figment).await,
|
None => Box::pin(self::server::Options::default().run(figment)).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user