Replace lazy_static with once_cell

`once_cell` is a simpler macroless alternative that will be added to the standard library.
This commit is contained in:
Brian Bowman
2022-07-09 05:53:13 -05:00
parent c3119ce7a7
commit e75474fde7
5 changed files with 10 additions and 25 deletions

View File

@@ -3,7 +3,7 @@
* https://github.com/omjadas/hudsucker/blob/main/examples/log.rs
*/
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::{sync::Mutex, str::FromStr};
use rcgen::*;
@@ -30,12 +30,7 @@ async fn shutdown_signal() {
}
// Global ver for getting server address.
lazy_static! {
static ref SERVER: Mutex<String> = {
let m = "http://localhost:443".to_string();
Mutex::new(m)
};
}
static SERVER: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new("http://localhost:443".to_string()));
#[derive(Clone)]
struct ProxyHandler;