systemd_jp/
systemd_unit.rs1use std::cell::RefCell;
2use std::rc::Rc;
3
4use super::*;
5
6pub struct SystemdUnit {
7
8 connection: Rc <RefCell <SystemdConnection>>,
9
10 name: String,
11 description: String,
12 load_state: SystemdLoadState,
13 active_state: SystemdActiveState,
14 sub_state: SystemdSubState,
15 following_unit: Option <String>,
16 unit_object_path: String,
17 job_id: u32,
18 job_type: SystemdJobType,
19 job_object_path: String,
20
21}
22
23impl SystemdUnit {
24
25 pub fn new (
26 connection: Rc <RefCell <SystemdConnection>>,
27 name: String,
28 description: String,
29 load_state: SystemdLoadState,
30 active_state: SystemdActiveState,
31 sub_state: SystemdSubState,
32 following_unit: Option <String>,
33 unit_object_path: String,
34 job_id: u32,
35 job_type: SystemdJobType,
36 job_object_path: String,
37 ) -> SystemdUnit {
38
39 SystemdUnit {
40 connection: connection,
41 name: name,
42 description: description,
43 load_state: load_state,
44 active_state: active_state,
45 sub_state: sub_state,
46 following_unit: following_unit,
47 unit_object_path: unit_object_path,
48 job_id: job_id,
49 job_type: job_type,
50 job_object_path: job_object_path,
51 }
52
53 }
54
55 pub fn name (& self) -> & str {
56 & self.name
57 }
58
59 pub fn description (& self) -> & str {
60 & self.name
61 }
62
63 pub fn load_state (& self) -> & SystemdLoadState {
64 & self.load_state
65 }
66
67 pub fn active_state (& self) -> & SystemdActiveState {
68 & self.active_state
69 }
70
71 pub fn sub_state (& self) -> & SystemdSubState {
72 & self.sub_state
73 }
74
75}
76
77