Mountain/IPC/Common/ServiceInfo/
ServiceEndpoint.rs1#![allow(non_snake_case)]
2
3use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct Struct {
11 pub Protocol:String,
12
13 pub Address:String,
14
15 pub Port:u16,
16
17 pub Path:Option<String>,
18}
19
20impl Struct {
21 pub fn new(Protocol:impl Into<String>, Address:impl Into<String>, Port:u16) -> Self {
22 Self { Protocol:Protocol.into(), Address:Address.into(), Port, Path:None }
23 }
24
25 pub fn NewUnix(Path:impl Into<String>) -> Self {
26 Self {
27 Protocol:"unix".to_string(),
28
29 Address:String::new(),
30
31 Port:0,
32
33 Path:Some(Path.into()),
34 }
35 }
36}