Skip to content

Commit

Permalink
arc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Nov 27, 2024
1 parent 699d90d commit 64abd45
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cidre/src/av/audio/speech_synthesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,6 @@ mod tests {
let attr_str = ns::AttrString::with_string(&str);
let ut = av::SpeechUtterance::with_attr_string(&attr_str);
assert_eq!(&ut.speech_string(), str);
assert_eq!(ut.speech_attr_string().unwrap().string(), str);
assert_eq!(&ut.speech_attr_string().unwrap().string(), str);
}
}
8 changes: 4 additions & 4 deletions cidre/src/mc/nearby_service_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ impl NearbyServiceBrowser {
pub fn set_delegate<D: Delegate>(&mut self, val: Option<&D>);

#[objc::msg_send(myPeerID)]
pub fn my_peer_id(&self) -> &mc::PeerId;
pub fn my_peer_id(&self) -> arc::R<mc::PeerId>;

#[objc::msg_send(serviceType)]
pub fn service_type(&self) -> &ns::String;
pub fn service_type(&self) -> arc::R<ns::String>;
}

#[objc::protocol(MCNearbyServiceBrowserDelegate)]
Expand Down Expand Up @@ -95,8 +95,8 @@ mod tests {
let peer = mc::PeerId::with_display_name(name).unwrap();
let service = ns::str!(c"cidre-txtchat");
let browser = mc::NearbyServiceBrowser::with_peer(&peer, &service).unwrap();
assert_eq!(browser.service_type(), service);
assert_eq!(browser.my_peer_id(), &peer);
assert_eq!(&browser.service_type(), service);
assert_eq!(&browser.my_peer_id(), &peer);

assert!(browser.delegate().is_none());
}
Expand Down
12 changes: 6 additions & 6 deletions cidre/src/mps/graph/operation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{define_obj_type, mps::graph, ns, objc};
use crate::{arc, define_obj_type, mps::graph, ns, objc};

define_obj_type!(
#[doc(alias = "MPSGraphOperation")]
Expand All @@ -7,18 +7,18 @@ define_obj_type!(

impl Op {
#[objc::msg_send(inputTensors)]
pub fn input_tensors(&self) -> &ns::Array<graph::Tensor>;
pub fn input_tensors(&self) -> arc::R<ns::Array<graph::Tensor>>;

#[objc::msg_send(outputTensors)]
pub fn output_tensors(&self) -> &ns::Array<graph::Tensor>;
pub fn output_tensors(&self) -> arc::R<ns::Array<graph::Tensor>>;

#[objc::msg_send(controlDependencies)]
pub fn control_deps(&self) -> &ns::Array<Self>;
pub fn control_deps(&self) -> arc::R<ns::Array<Self>>;

/// Graph on which the operation is defined
#[objc::msg_send(graph)]
pub fn graph(&self) -> &graph::Graph;
pub fn graph(&self) -> arc::R<graph::Graph>;

#[objc::msg_send(name)]
pub fn name(&self) -> &ns::String;
pub fn name(&self) -> arc::R<ns::String>;
}
4 changes: 2 additions & 2 deletions cidre/src/ns/attributed_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl AttrString {
/// the attributed string object. If you want to maintain a snapshot of this as
/// you manipulate the returned string, you should make a copy of the appropriate substring.
#[objc::msg_send(string)]
pub fn string(&self) -> &ns::String;
pub fn string(&self) -> arc::R<ns::String>;

#[objc::msg_send(length)]
pub fn len(&self) -> usize;
Expand Down Expand Up @@ -358,7 +358,7 @@ mod tests {
let str = ns::String::with_str("Hello");
let astr = ns::AttrString::with_string(&str);

assert_eq!(astr.string(), &str);
assert_eq!(&astr.string(), &str);
let attrs = astr.attrs_at(0, None).unwrap();
assert!(attrs.is_empty());

Expand Down
2 changes: 1 addition & 1 deletion cidre/src/ns/file_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl FileManager {
}

#[objc::msg_send(currentDirectoryPath)]
pub fn current_dir_path(&self) -> &ns::String;
pub fn current_dir_path(&self) -> arc::R<ns::String>;

#[objc::msg_send(changeCurrentDirectoryPath:)]
pub fn change_current_dir_path(&mut self, path: &ns::String) -> bool;
Expand Down
6 changes: 3 additions & 3 deletions cidre/src/sn/classification_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define_obj_type!(

impl Classification {
#[objc::msg_send(identifier)]
pub fn id(&self) -> &ns::String;
pub fn id(&self) -> arc::R<ns::String>;

#[objc::msg_send(confidence)]
pub fn confidence(&self) -> f64;
Expand All @@ -21,13 +21,13 @@ define_obj_type!(

impl ClassificationResult {
#[objc::msg_send(classifications)]
pub fn classifications(&self) -> &ns::Array<Classification>;
pub fn classifications(&self) -> arc::R<ns::Array<Classification>>;

#[objc::msg_send(timeRange)]
pub fn time_range(&self) -> cm::TimeRange;

#[objc::msg_send(classificationForIdentifier:)]
pub fn classification_for_id<'a>(&'a self, id: &ns::String) -> Option<&'a Classification>;
pub fn classification_for_id(&self, id: &ns::String) -> Option<arc::R<Classification>>;
}

extern "C" {
Expand Down
16 changes: 8 additions & 8 deletions cidre/src/un/notification_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,38 @@ impl NotificationContent {

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(body)]
pub fn body(&self) -> &ns::String;
pub fn body(&self) -> arc::R<ns::String>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(categoryIdentifier)]
pub fn category_id(&self) -> &ns::String;
pub fn category_id(&self) -> arc::R<ns::String>;

#[cfg(not(any(target_os = "tvos", target_os = "macos")))]
#[objc::msg_send(launchImageName)]
pub fn launch_image_name(&self) -> &ns::String;
pub fn launch_image_name(&self) -> arc::R<ns::String>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(sound)]
pub fn sound(&self) -> Option<&un::NotificationSound>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(subtitle)]
pub fn subtitle(&self) -> &ns::String;
pub fn subtitle(&self) -> arc::R<ns::String>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(threadIdentifier)]
pub fn thread_id(&self) -> &ns::String;
pub fn thread_id(&self) -> arc::R<ns::String>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(title)]
pub fn title(&self) -> &ns::String;
pub fn title(&self) -> arc::R<ns::String>;

#[cfg(not(target_os = "tvos"))]
#[objc::msg_send(userInfo)]
pub fn user_info(&self) -> &ns::Dictionary<ns::Id, ns::Id>;
pub fn user_info(&self) -> arc::R<ns::Dictionary<ns::Id, ns::Id>>;

#[objc::msg_send(targetContentIdentifier)]
pub fn target_content_id(&self) -> Option<&ns::String>;
pub fn target_content_id(&self) -> Option<arc::R<ns::String>>;

#[objc::msg_send(interruptionLevel)]
pub fn interruption_level(&self) -> un::NotificationInterruptionLevel;
Expand Down
4 changes: 2 additions & 2 deletions cidre/src/un/notification_request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{define_cls, define_obj_type, ns, objc};
use crate::{arc, define_cls, define_obj_type, ns, objc};

define_obj_type!(
#[doc(alias = "UNNotificationRequest")]
Expand All @@ -9,7 +9,7 @@ impl NotificationRequest {
define_cls!(UN_NOTIFICATION_REQUEST);

#[objc::msg_send(identifier)]
pub fn id(&self) -> &ns::String;
pub fn id(&self) -> arc::R<ns::String>;
}

extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions cidre/src/vn/generate_person_segmentation_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl GenPersonSegmentationRequest {
pub fn set_output_pixel_format(&mut self, value: os::Type);

#[objc::msg_send(results)]
pub fn results(&self) -> Option<&ns::Array<vn::PixelBufObservation>>;
pub fn results(&self) -> Option<arc::R<ns::Array<vn::PixelBufObservation>>>;

#[objc::msg_send(supportedOutputPixelFormatsAndReturnError:)]
#[api::available(
Expand All @@ -53,8 +53,8 @@ impl GenPersonSegmentationRequest {
tvos = 18.0,
visionos = 2.0
)]
pub fn supported_output_pixel_formats<'ear>(
) -> Result<arc::R<ns::Array<ns::Number>>, &'ear ns::Error> {
pub fn supported_output_pixel_formats<'ear>() -> ns::Result<'ear, arc::R<ns::Array<ns::Number>>>
{
ns::if_none(|err| unsafe { Self::supported_output_pixel_formats_err(err) })
}
}
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/wk/web_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl WebView {
pub fn set_nav_delegate<D: wk::NavigationDelegate>(&mut self, val: Option<&D>);

#[objc::msg_send(title)]
pub fn title(&self) -> &ns::String;
pub fn title(&self) -> arc::R<ns::String>;

#[objc::msg_send(isInspectable)]
pub fn is_inpectable(&self) -> bool;
Expand Down

0 comments on commit 64abd45

Please sign in to comment.