diff options
Diffstat (limited to 'src/util/data.rs')
-rw-r--r-- | src/util/data.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/data.rs b/src/util/data.rs index 6df51cd0..d4fe0009 100644 --- a/src/util/data.rs +++ b/src/util/data.rs @@ -87,6 +87,18 @@ impl FixedBytes32 { } } +impl From<netapp::NodeID> for FixedBytes32 { + fn from(node_id: netapp::NodeID) -> FixedBytes32 { + FixedBytes32::try_from(node_id.as_ref()).unwrap() + } +} + +impl Into<netapp::NodeID> for FixedBytes32 { + fn into(self) -> netapp::NodeID { + netapp::NodeID::from_slice(self.as_slice()).unwrap() + } +} + /// A 32 bytes UUID pub type Uuid = FixedBytes32; /// A 256 bit cryptographic hash, can be sha256 or blake2 depending on provenance |