summaryrefslogtreecommitdiffstats
path: root/vendor/core-foundation/src/uuid.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/core-foundation/src/uuid.rs')
-rw-r--r--vendor/core-foundation/src/uuid.rs32
1 files changed, 7 insertions, 25 deletions
diff --git a/vendor/core-foundation/src/uuid.rs b/vendor/core-foundation/src/uuid.rs
index 6be734dab..834a6dd9d 100644
--- a/vendor/core-foundation/src/uuid.rs
+++ b/vendor/core-foundation/src/uuid.rs
@@ -12,15 +12,14 @@
#[cfg(feature = "with-uuid")]
extern crate uuid;
-pub use core_foundation_sys::uuid::*;
use core_foundation_sys::base::kCFAllocatorDefault;
+pub use core_foundation_sys::uuid::*;
-use base::TCFType;
+use crate::base::TCFType;
#[cfg(feature = "with-uuid")]
use self::uuid::Uuid;
-
declare_TCFType! {
/// A UUID.
CFUUID, CFUUIDRef
@@ -45,28 +44,12 @@ impl Default for CFUUID {
}
#[cfg(feature = "with-uuid")]
-impl Into<Uuid> for CFUUID {
- fn into(self) -> Uuid {
- let b = unsafe {
- CFUUIDGetUUIDBytes(self.0)
- };
+impl From<CFUUID> for Uuid {
+ fn from(val: CFUUID) -> Self {
+ let b = unsafe { CFUUIDGetUUIDBytes(val.0) };
let bytes = [
- b.byte0,
- b.byte1,
- b.byte2,
- b.byte3,
- b.byte4,
- b.byte5,
- b.byte6,
- b.byte7,
- b.byte8,
- b.byte9,
- b.byte10,
- b.byte11,
- b.byte12,
- b.byte13,
- b.byte14,
- b.byte15,
+ b.byte0, b.byte1, b.byte2, b.byte3, b.byte4, b.byte5, b.byte6, b.byte7, b.byte8,
+ b.byte9, b.byte10, b.byte11, b.byte12, b.byte13, b.byte14, b.byte15,
];
Uuid::from_bytes(&bytes).unwrap()
}
@@ -101,7 +84,6 @@ impl From<Uuid> for CFUUID {
}
}
-
#[cfg(test)]
#[cfg(feature = "with-uuid")]
mod test {