MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / new

Method new

packages/server/src/config.rs:24–55  ·  view source on GitHub ↗
(
        http_port: u16,
        client_root: PathBuf,
        bind_ip: IpAddr,
        advertise_host: Option<String>,
        server_kind: ServerKind,
        video_codec: String,
        low_laten

Source from the content-addressed store, hash-verified

22impl Config {
23 #[allow(clippy::too_many_arguments)]
24 pub fn new(
25 http_port: u16,
26 client_root: PathBuf,
27 bind_ip: IpAddr,
28 advertise_host: Option<String>,
29 server_kind: ServerKind,
30 video_codec: String,
31 low_latency: bool,
32 access_token: Option<String>,
33 pairing_code: Option<String>,
34 ) -> Self {
35 let advertise_host = advertise_host.unwrap_or_else(|| match bind_ip {
36 IpAddr::V4(ip) if ip.is_unspecified() => Ipv4Addr::LOCALHOST.to_string(),
37 IpAddr::V6(ip) if ip.is_unspecified() => Ipv4Addr::LOCALHOST.to_string(),
38 _ => bind_ip.to_string(),
39 });
40 let host_name = local_host_name();
41 let host_id = host_identity(&host_name);
42 Self {
43 access_token: access_token.unwrap_or_else(crate::auth::generate_access_token),
44 advertise_host,
45 host_id,
46 host_name,
47 server_kind,
48 bind_ip,
49 http_port,
50 pairing_code,
51 client_root,
52 video_codec,
53 low_latency,
54 }
55 }
56
57 pub fn http_addr(&self) -> SocketAddr {
58 SocketAddr::new(self.bind_ip, self.http_port)

Callers

nothing calls this directly

Calls 2

local_host_nameFunction · 0.85
host_identityFunction · 0.85

Tested by

no test coverage detected