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 pub Address:String,
13 pub Port:u16,
14 pub Path:Option<String>,
15}
16
17impl Struct {
18 pub fn new(Protocol:impl Into<String>, Address:impl Into<String>, Port:u16) -> Self {
19 Self { Protocol:Protocol.into(), Address:Address.into(), Port, Path:None }
20 }
21
22 pub fn NewUnix(Path:impl Into<String>) -> Self {
23 Self {
24 Protocol:"unix".to_string(),
25 Address:String::new(),
26 Port:0,
27 Path:Some(Path.into()),
28 }
29 }
30}