webterm_core/models/
device_id.rs1use std::fmt;
2
3#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
4pub struct DeviceId {
5 device_name: String,
6 device_subname: String,
7}
8
9impl fmt::Display for DeviceId {
10 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
11 write!(f, "{}/{}", self.device_name, self.device_subname)
12 }
13}
14
15impl DeviceId {
16 pub fn new(device_name: String, device_subname: String) -> Self {
17 Self {
18 device_name,
19 device_subname,
20 }
21 }
22
23 pub fn name(&self) -> &str {
24 &self.device_name
25 }
26
27 pub fn subname(&self) -> &str {
28 &self.device_subname
29 }
30}