use crate::{Attribute, ua};
macro_rules! attribute_impl {
($( ($name:ident, $value:ident) ),* $(,)?) => {
$(
#[derive(Debug, Clone, Copy)]
pub struct $name;
impl $crate::Attribute for $name {
type Value = $crate::ua::$value;
fn id(&self) -> $crate::ua::AttributeId {
paste::paste! {
$crate::ua::AttributeId::[<$name:upper>]
}
}
}
impl $crate::ua::AttributeId {
paste::paste! {
#[doc = concat!("[`", stringify!([<$name:upper>]), "`](Self::", stringify!([<$name:upper>]), ").")]
pub const [<$name:upper _T>]: $crate::attributes::$name =
$crate::attributes::$name;
}
}
)*
};
}
attribute_impl!(
(NodeId, NodeId),
(NodeClass, NodeClass),
(BrowseName, QualifiedName),
(DisplayName, LocalizedText),
(Description, LocalizedText),
(WriteMask, AttributeWriteMask),
(UserWriteMask, AttributeWriteMask),
(IsAbstract, Boolean),
(Symmetric, Boolean),
(InverseName, LocalizedText),
(ContainsNoLoops, Boolean),
(EventNotifier, EventNotifierType),
(Value, Variant),
(DataType, NodeId),
(ValueRank, Int32),
(AccessLevel, AccessLevelType),
(UserAccessLevel, AccessLevelType),
(MinimumSamplingInterval, Duration),
(Historizing, Boolean),
(Executable, Boolean),
(UserExecutable, Boolean),
(DataTypeDefinition, DataTypeDefinition),
(AccessRestrictions, AccessRestrictionType),
(AccessLevelEx, AccessLevelExType),
);
impl Attribute for &ua::AttributeId {
type Value = ua::Variant;
fn id(&self) -> ua::AttributeId {
(*self).clone()
}
}