From 1627645232ce9ee339b9efbbe779ce7c5cdd3d25 Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Mon, 6 May 2024 16:29:22 +0200 Subject: [PATCH] feat: derive Ord for NodeId --- lib/src/types/byte_string.rs | 2 +- lib/src/types/guid.rs | 2 +- lib/src/types/node_id.rs | 4 ++-- lib/src/types/string.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/types/byte_string.rs b/lib/src/types/byte_string.rs index 0753ea32d..6b8205c10 100644 --- a/lib/src/types/byte_string.rs +++ b/lib/src/types/byte_string.rs @@ -17,7 +17,7 @@ use crate::types::{ }; /// A sequence of octets. -#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub struct ByteString { pub value: Option>, } diff --git a/lib/src/types/guid.rs b/lib/src/types/guid.rs index 9c7205852..08ddad4ef 100644 --- a/lib/src/types/guid.rs +++ b/lib/src/types/guid.rs @@ -15,7 +15,7 @@ use uuid::Uuid; use crate::types::encoding::*; /// A Guid is a 16 byte Globally Unique Identifier. -#[derive(Eq, PartialEq, Clone, Hash)] +#[derive(Eq, PartialEq, Clone, Hash, PartialOrd, Ord)] pub struct Guid { uuid: Uuid, } diff --git a/lib/src/types/node_id.rs b/lib/src/types/node_id.rs index 39adaa3f8..906b40462 100644 --- a/lib/src/types/node_id.rs +++ b/lib/src/types/node_id.rs @@ -24,7 +24,7 @@ use crate::types::{ }; /// The kind of identifier, numeric, string, guid or byte -#[derive(Eq, PartialEq, Clone, Debug, Hash, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Clone, Debug, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub enum Identifier { Numeric(u32), String(UAString), @@ -123,7 +123,7 @@ impl fmt::Display for NodeIdError { impl std::error::Error for NodeIdError {} /// An identifier for a node in the address space of an OPC UA Server. -#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize)] +#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub struct NodeId { /// The index for a namespace pub namespace: u16, diff --git a/lib/src/types/string.rs b/lib/src/types/string.rs index 746f2ffea..844b32825 100644 --- a/lib/src/types/string.rs +++ b/lib/src/types/string.rs @@ -23,7 +23,7 @@ use crate::types::{ /// A string contains UTF-8 encoded characters or a null value. A null value is distinct from /// being an empty string so internally, the code maintains that distinction by holding the value /// as an `Option`. -#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub struct UAString { value: Option, }