pingora
pingora copied to clipboard
feat: Enhance Server::new to accept impl Into<Option<Opt>> for ergonomics
This PR simplifies the Server::new function interface by allowing direct passing of Opt or None without the need to wrap with Some. This enhancement makes the API more ergonomic and user-friendly.
Changes:
- Before: Required to wrap
OptwithSome.
let my_server = Server::new(Some(Opt::from_args())).unwrap();
- After: Direct passing of
OptorNone.
let my_server = Server::new(Opt::from_args()).unwrap();
let my_server = Server::new(None).unwrap();
// The previous method of wrapping `Opt` with `Some` is still supported.
let my_server = Server::new(Some(Opt::from_args())).unwrap();
This update streamlines function calls, improving the overall developer experience.