Skip to content

Commit

Permalink
Simplify a bit creating RelativePath in a common case
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier committed Jan 8, 2025
1 parent 7fc6a17 commit 06f1b2c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions opcua-types/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use crate::{
AnonymousIdentityToken, ApplicationDescription, CallMethodRequest, DataTypeId,
EndpointDescription, Error, ExpandedNodeId, HistoryUpdateType, IdentityCriteriaType,
MessageSecurityMode, MonitoredItemCreateRequest, MonitoringMode, MonitoringParameters,
NumericRange, ObjectId, ReadValueId, ServiceCounterDataType, ServiceFault, SignatureData,
UserNameIdentityToken, UserTokenPolicy, UserTokenType,
NumericRange, ObjectId, ReadValueId, ReferenceTypeId, RelativePath, ServiceCounterDataType,
ServiceFault, SignatureData, UserNameIdentityToken, UserTokenPolicy, UserTokenType,
};

use super::PerformUpdateType;
Expand Down Expand Up @@ -414,3 +414,20 @@ impl Default for IdentityCriteriaType {
Self::Anonymous
}
}

impl From<&[QualifiedName]> for RelativePath {
fn from(value: &[QualifiedName]) -> Self {
let elements = value
.iter()
.map(|qn| super::relative_path_element::RelativePathElement {
reference_type_id: ReferenceTypeId::HierarchicalReferences.into(),
is_inverse: false,
include_subtypes: true,
target_name: qn.clone(),
})
.collect();
Self {
elements: Some(elements),
}
}
}

0 comments on commit 06f1b2c

Please sign in to comment.