Skip to content

Commit 2e2b428

Browse files
authored
Merge pull request #349 from madsmtm/remove-uuid-feature
Remove the optional `uuid` integration from `icrate`
2 parents 76ec575 + e0d6b24 commit 2e2b428

File tree

7 files changed

+22
-38
lines changed

7 files changed

+22
-38
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ env:
4949
#
5050
# Note: The `exception` feature is not enabled here, since it requires
5151
# compiling C code, even if just running a `check`/`clippy` build.
52-
INTERESTING_FEATURES: malloc,block,verify,uuid,unstable-private
52+
INTERESTING_FEATURES: malloc,block,verify,unstable-private
5353
UNSTABLE_FEATURES: unstable-autoreleasesafe,unstable-c-unwind
5454
# Required when we want to use a different runtime than the default `apple`
5555
OTHER_RUNTIME: --no-default-features --features=std

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/icrate/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1515
* Updated the SDK version from XCode `14.0.1` to `14.2`.
1616
- See differences [here](https://sdk.news/macOS-13.0/).
1717

18+
### Removed
19+
* **BREAKING**: The optional `uuid` integration, since one might want to use
20+
`icrate` internally in that crate in the future, and that would break.
21+
1822

1923
## icrate 0.0.1 - 2022-12-24
2024

crates/icrate/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ license = "MIT"
2323
objc2 = { path = "../objc2", version = "=0.3.0-beta.4", default-features = false, optional = true }
2424
block2 = { path = "../block2", version = "=0.2.0-alpha.7", default-features = false, optional = true }
2525

26-
# Provide methods to convert between `uuid::Uuid` and `icrate::Foundation::NSUUID`
27-
uuid = { version = "1.1.2", optional = true, default-features = false }
28-
2926
[package.metadata.docs.rs]
3027
default-target = "x86_64-apple-darwin"
31-
features = ["block", "objective-c", "uuid", "unstable-frameworks-all", "unstable-private", "unstable-docsrs"]
28+
features = ["block", "objective-c", "unstable-frameworks-all", "unstable-private", "unstable-docsrs"]
3229

3330
targets = [
3431
# MacOS

crates/icrate/src/Foundation/additions/uuid.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ impl NSUUID {
2020
Self::from_bytes([0; 16])
2121
}
2222

23+
/// Create a new `NSUUID` from the given bytes.
24+
///
25+
///
26+
/// # Example
27+
///
28+
/// Create a new `NSUUID` from the `uuid` crate.
29+
///
30+
/// ```ignore
31+
/// use uuid::Uuid;
32+
/// use icrate::Foundation::NSUUID;
33+
///
34+
/// let uuid: Uuid;
35+
/// # uuid = todo!();
36+
/// let obj = NSUUID::from_bytes(uuid.into_bytes());
37+
/// assert_eq!(obj.as_bytes(), uuid.into_bytes());
38+
/// ```
2339
pub fn from_bytes(bytes: [u8; 16]) -> Id<Self, Shared> {
2440
let bytes = UuidBytes(bytes);
2541
Self::initWithUUIDBytes(Self::alloc(), &bytes)
@@ -68,18 +84,6 @@ impl fmt::Debug for NSUUID {
6884
// }
6985
// }
7086

71-
/// Conversion methods to/from `uuid` crate.
72-
#[cfg(feature = "uuid")]
73-
impl NSUUID {
74-
pub fn from_uuid(uuid: uuid::Uuid) -> Id<Self, Shared> {
75-
Self::from_bytes(uuid.into_bytes())
76-
}
77-
78-
pub fn as_uuid(&self) -> uuid::Uuid {
79-
uuid::Uuid::from_bytes(self.as_bytes())
80-
}
81-
}
82-
8387
impl DefaultId for NSUUID {
8488
type Ownership = Shared;
8589
fn default_id() -> Id<Self, Self::Ownership> {

crates/icrate/src/Foundation/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@
9898
//! | `NSEnumerator<T, Shared>` | `impl Iterator<Arc<T>>` |
9999
//! | `NSEnumerator<T, Owned>` | `impl Iterator<T>` |
100100
//! | `@protocol NSCopying` | `trait Clone` |
101-
//!
102-
//!
103-
//! # Feature flags
104-
//!
105-
//! `"uuid"` -> Enables conversion methods between `NSUUID` and `uuid::Uuid`.
106101
#![allow(unused_imports)]
107102

108103
#[doc(hidden)]

crates/icrate/tests/uuid.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,3 @@ fn display_debug() {
2929
// let uuid2 = NSUUID::from_bytes([9; 16]);
3030
// assert!(uuid1 > uuid2);
3131
// }
32-
33-
#[cfg(feature = "uuid")]
34-
#[test]
35-
fn test_convert_roundtrip() {
36-
let nsuuid1 = NSUUID::UUID();
37-
let uuid = nsuuid1.as_uuid();
38-
let nsuuid2 = NSUUID::from_uuid(uuid);
39-
assert_eq!(nsuuid1, nsuuid2);
40-
}

0 commit comments

Comments
 (0)