egml_core/model/base/
association_attributes_access.rs1use crate::model::base::AssociationAttributes;
2use crate::model::basic_types::NilReason;
3use crate::model::xlink::{ActuateType, HRef, ShowType};
4
5pub trait HasAssociationAttributes {
7 fn association(&self) -> &AssociationAttributes;
8
9 fn href(&self) -> Option<&HRef> {
11 self.association().href.as_ref()
12 }
13
14 fn local_id(&self) -> Option<&str> {
16 self.association().local_id()
17 }
18
19 fn nil_reason(&self) -> Option<&NilReason> {
21 self.association().nil_reason.as_ref()
22 }
23
24 fn title(&self) -> Option<&str> {
26 self.association().title.as_deref()
27 }
28
29 fn role(&self) -> Option<&str> {
31 self.association().role.as_deref()
32 }
33
34 fn arcrole(&self) -> Option<&str> {
36 self.association().arcrole.as_deref()
37 }
38
39 fn show(&self) -> Option<&ShowType> {
41 self.association().show.as_ref()
42 }
43
44 fn actuate(&self) -> Option<&ActuateType> {
46 self.association().actuate.as_ref()
47 }
48}
49
50pub trait HasAssociationAttributesMut: HasAssociationAttributes {
52 fn association_mut(&mut self) -> &mut AssociationAttributes;
53
54 fn set_href(&mut self, href: HRef) {
56 self.association_mut().href = Some(href);
57 }
58
59 fn set_href_opt(&mut self, href: Option<HRef>) {
61 self.association_mut().href = href;
62 }
63
64 fn clear_href(&mut self) {
66 self.association_mut().href = None;
67 }
68
69 fn set_nil_reason(&mut self, nil_reason: NilReason) {
71 self.association_mut().nil_reason = Some(nil_reason);
72 }
73
74 fn set_nil_reason_opt(&mut self, nil_reason: Option<NilReason>) {
76 self.association_mut().nil_reason = nil_reason;
77 }
78
79 fn clear_nil_reason(&mut self) {
81 self.association_mut().nil_reason = None;
82 }
83
84 fn set_title(&mut self, title: impl Into<String>) {
86 self.association_mut().title = Some(title.into());
87 }
88
89 fn set_title_opt(&mut self, title: Option<String>) {
91 self.association_mut().title = title;
92 }
93
94 fn clear_title(&mut self) {
96 self.association_mut().title = None;
97 }
98
99 fn set_role(&mut self, role: impl Into<String>) {
101 self.association_mut().role = Some(role.into());
102 }
103
104 fn set_role_opt(&mut self, role: Option<String>) {
106 self.association_mut().role = role;
107 }
108
109 fn clear_role(&mut self) {
111 self.association_mut().role = None;
112 }
113
114 fn set_arcrole(&mut self, arcrole: impl Into<String>) {
116 self.association_mut().arcrole = Some(arcrole.into());
117 }
118
119 fn set_arcrole_opt(&mut self, arcrole: Option<String>) {
121 self.association_mut().arcrole = arcrole;
122 }
123
124 fn clear_arcrole(&mut self) {
126 self.association_mut().arcrole = None;
127 }
128
129 fn set_show(&mut self, show: ShowType) {
131 self.association_mut().show = Some(show);
132 }
133
134 fn set_show_opt(&mut self, show: Option<ShowType>) {
136 self.association_mut().show = show;
137 }
138
139 fn clear_show(&mut self) {
141 self.association_mut().show = None;
142 }
143
144 fn set_actuate(&mut self, actuate: ActuateType) {
146 self.association_mut().actuate = Some(actuate);
147 }
148
149 fn set_actuate_opt(&mut self, actuate: Option<ActuateType>) {
151 self.association_mut().actuate = actuate;
152 }
153
154 fn clear_actuate(&mut self) {
156 self.association_mut().actuate = None;
157 }
158}