From 15cffed202c1a1cdd35ebf9b6649268fb54acaba Mon Sep 17 00:00:00 2001 From: gengteng Date: Sun, 3 Mar 2024 12:26:22 +0800 Subject: [PATCH] feat: Enhance Server::new to accept impl Into> for ergonomics --- pingora-core/src/server/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs index 42735507..75112070 100644 --- a/pingora-core/src/server/mod.rs +++ b/pingora-core/src/server/mod.rs @@ -176,7 +176,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() {