This is an automated email from the ASF dual-hosted git repository.

ivila pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git

commit 835c2b399a4c2e3fbad6bdbdceb14a78b25cb8eb
Author: ivila <[email protected]>
AuthorDate: Tue Mar 25 11:08:06 2025 +0800

    optee_teec: Uuid: implement Clone and fix doc
    
    Signed-off-by: Zehui Chen <[email protected]>
    Reviewed-by: Yuan Zhuang <[email protected]>
---
 optee-teec/src/uuid.rs | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/optee-teec/src/uuid.rs b/optee-teec/src/uuid.rs
index f6ffd1f..163afdd 100644
--- a/optee-teec/src/uuid.rs
+++ b/optee-teec/src/uuid.rs
@@ -17,7 +17,6 @@
 
 use crate::raw;
 use core::fmt;
-use hex;
 use uuid as uuid_crate;
 use uuid_crate::parser::ParseError;
 use uuid_crate::BytesError;
@@ -34,7 +33,12 @@ impl Uuid {
     /// # Examples
     ///
     /// ```
-    /// let uuid = 
Uuid::parse_str("8abcf200-2450-11e4-abe2-0002a5d5c51b").unwrap();
+    /// # use optee_teec::Uuid;
+    /// # use uuid::parser::ParseError;
+    /// # fn main() -> Result<(), ParseError> {
+    /// let uuid = Uuid::parse_str("8abcf200-2450-11e4-abe2-0002a5d5c51b")?;
+    /// # Ok(())
+    /// # }
     /// ```
     pub fn parse_str(input: &str) -> Result<Uuid, ParseError> {
         let uuid = uuid_crate::Uuid::parse_str(input)?;
@@ -52,6 +56,7 @@ impl Uuid {
     /// # Examples
     ///
     /// ```
+    /// # use optee_teec::Uuid;
     /// let bytes: [u8; 16] = [70, 235, 208, 238, 14, 109, 67, 201, 185, 13, 
204, 195, 90, 145, 63, 62,];
     /// let uuid = Uuid::from_bytes(bytes);
     /// ```
@@ -66,8 +71,12 @@ impl Uuid {
     /// # Examples
     ///
     /// ```
+    /// # use optee_teec::Uuid;
+    /// # fn main() -> Result<(), uuid::BytesError> {
     /// let bytes: &[u8; 16] = &[70, 235, 208, 238, 14, 109, 67, 201, 185, 13, 
204, 195, 90, 145, 63, 62,];
-    /// let uuid = Uuid::from_slice(bytes);
+    /// let uuid = Uuid::from_slice(bytes)?;
+    /// # Ok(())
+    /// # }
     /// ```
     pub fn from_slice(b: &[u8]) -> Result<Uuid, BytesError> {
         let uuid = uuid_crate::Uuid::from_slice(b)?;
@@ -102,6 +111,17 @@ impl Uuid {
     }
 }
 
+impl Clone for Uuid {
+    fn clone(&self) -> Self {
+        Self::new_raw(
+            self.raw.timeLow,
+            self.raw.timeMid,
+            self.raw.timeHiAndVersion,
+            self.raw.clockSeqAndNode,
+        )
+    }
+}
+
 impl fmt::Display for Uuid {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to