From 558371c190b086e16942de622d9d3a68d30b4b4f Mon Sep 17 00:00:00 2001 From: gengteng Date: Sun, 3 Mar 2024 04:26:22 +0000 Subject: [PATCH] feat: Enhance Server::new to accept impl Into> for ergonomics Replicated-from: https://github.com/cloudflare/pingora/pull/100 Includes-commit: 15cffed202c1a1cdd35ebf9b6649268fb54acaba --- .bleep | 2 +- pingora-core/src/server/mod.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.bleep b/.bleep index a37da60b..4508557a 100644 --- a/.bleep +++ b/.bleep @@ -1 +1 @@ -b1c09703606d32b02f24d2e77d82936ba95e8064 \ No newline at end of file +ff2f3fb1c3c2b52d92fd5ff3b76b6f4d25488fb2 \ No newline at end of file diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs index fa2cea21..9c29aafe 100644 --- a/pingora-core/src/server/mod.rs +++ b/pingora-core/src/server/mod.rs @@ -175,7 +175,8 @@ impl Server { /// /// Command line options can either be passed by parsing the command line arguments via /// `Opt::from_args()`, or be generated by other means. - pub fn new(opt: Option) -> Result { + pub fn new(opt: impl Into>) -> Result { + let opt = opt.into(); let (tx, rx) = watch::channel(false); let conf = if let Some(opt) = opt.as_ref() {