Skip to content

Commit

Permalink
More ns::Uuid API
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jan 3, 2024
1 parent b70cda1 commit a50ddb0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cidre/src/ns/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ define_obj_type!(

unsafe impl Send for Uuid {}

impl Uuid {
#[objc::msg_send(UUIDString)]
fn string_ar(&self) -> arc::Rar<ns::String>;

#[objc::rar_retain]
fn string(&self) -> arc::R<ns::String>;
}

#[link(name = "ns", kind = "static")]
extern "C" {
static NS_UUID: &'static objc::Class<Uuid>;
Expand All @@ -18,6 +26,9 @@ mod tests {

#[test]
fn basics() {
let _uuid = ns::Uuid::new();
let uuid = ns::Uuid::new();

let string = uuid.string();
assert!(!string.is_empty());
}
}

0 comments on commit a50ddb0

Please sign in to comment.