Skip to content

Commit

Permalink
Switch from ctor to inline instantiation
Browse files Browse the repository at this point in the history
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
  • Loading branch information
nitishm committed Aug 12, 2021
1 parent b3765f8 commit 788a3e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 35 deletions.
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ impl Router {
"/healthz" => Ok(Response::new(Body::from("OK"))),
_ => match self.module_store.handler_for_path(uri_path).await {
Ok(h) => {
let info = RouterInfo::new(
h.entrypoint.as_str(),
client_addr,
self.cache_config_path.clone(),
self.module_cache.clone(),
self.base_log_dir.clone(),
self.default_host.to_owned(),
self.use_tls,
self.global_env_vars.clone(),
);
let info = RouterInfo{
entrypoint: h.entrypoint,
client_addr: client_addr,
cache_config_path: self.cache_config_path.clone(),
module_cache_dir: self.module_cache.clone(),
base_log_dir: self.base_log_dir.clone(),
default_host: self.default_host.to_owned(),
use_tls : self.use_tls,
env_vars: self.global_env_vars.clone(),
};

let res = h
.module
Expand Down
25 changes: 0 additions & 25 deletions src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,6 @@ pub struct RouterInfo {
pub env_vars: HashMap<String, String>,
}

impl RouterInfo {
pub fn new(
entrypoint: &str,
client_addr: SocketAddr,
cache_config_path: PathBuf,
module_cache_dir: PathBuf,
base_log_dir: PathBuf,
default_host: String,
use_tls: bool,
env_vars: HashMap<String, String>,
) -> Self {

RouterInfo {
entrypoint: String::from(entrypoint),
client_addr,
cache_config_path,
module_cache_dir,
base_log_dir,
default_host,
use_tls,
env_vars,
}
}
}

/// An internal representation of a mapping from a URI fragment to a function in a module.
#[derive(Clone)]
pub struct RouteEntry {
Expand Down

0 comments on commit 788a3e0

Please sign in to comment.