diff --git a/cidre/src/av/audio/session/route.rs b/cidre/src/av/audio/session/route.rs index 20115fcf..313bb3fb 100644 --- a/cidre/src/av/audio/session/route.rs +++ b/cidre/src/av/audio/session/route.rs @@ -1,4 +1,4 @@ -use crate::{av, define_obj_type, ns, objc}; +use crate::{arc, av, define_obj_type, ns, objc}; define_obj_type!( /// The location of a data source on an iOS device. @@ -106,11 +106,11 @@ define_obj_type!( impl ChannelDesc { /// A human-readable name for the channel. #[objc::msg_send(channelName)] - pub fn channel_name(&self) -> &ns::String; + pub fn channel_name(&self) -> arc::R; /// The UID (unique identifier) of the port owning the channel #[objc::msg_send(owningPortUID)] - pub fn owning_port_uid(&self) -> &ns::String; + pub fn owning_port_uid(&self) -> arc::R; #[objc::msg_send(channelNumber)] pub fn channel_number(&self) -> usize; @@ -129,11 +129,11 @@ impl DataSrcDesc { // TODO: verify leak /// System-assigned ID for the data source. #[objc::msg_send(dataSourceID)] - pub fn data_src_id(&self) -> &ns::String; + pub fn data_src_id(&self) -> arc::R; /// Human-readable name for the data source. #[objc::msg_send(dataSourceName)] - pub fn data_source_name(&self) -> &ns::String; + pub fn data_source_name(&self) -> arc::R; /// Location and orientation can be used to distinguish between multiple data sources /// belonging to a single port. For example, in the case of a port of type @@ -142,21 +142,21 @@ impl DataSrcDesc { /// /// Will be nil for data sources for which the location is not known. #[objc::msg_send(location)] - pub fn location(&self) -> Option<&Location>; + pub fn location(&self) -> Option>; /// Describes the orientation of a data source. Will be nil for data sources for which the /// orientation is not known. #[objc::msg_send(orientation)] - pub fn orientation(&self) -> Option<&Orientation>; + pub fn orientation(&self) -> Option>; #[objc::msg_send(supportedPolarPatterns)] - pub fn supported_polar_patterns(&self) -> Option<&ns::Array>; + pub fn supported_polar_patterns(&self) -> Option>>; #[objc::msg_send(selectedPolarPattern)] - pub fn selected_polar_pattern(&self) -> Option<&PolarPattern>; + pub fn selected_polar_pattern(&self) -> Option>; #[objc::msg_send(preferredPolarPattern)] - pub fn preferred_polar_pattern(&self) -> Option<&PolarPattern>; + pub fn preferred_polar_pattern(&self) -> Option>; // - (BOOL)setPreferredPolarPattern:(nullable AVAudioSessionPolarPattern)pattern error:(NSError **)outError @@ -189,13 +189,13 @@ define_obj_type!( impl PortDesc { #[objc::msg_send(portType)] - pub fn port_type(&self) -> &av::AudioSessionPort; + pub fn port_type(&self) -> arc::R; #[objc::msg_send(portName)] - pub fn port_name(&self) -> &ns::String; + pub fn port_name(&self) -> arc::R; #[objc::msg_send(UID)] - pub fn uid(&self) -> &ns::String; + pub fn uid(&self) -> arc::R; /// This property's value will be true if the associated hardware port has built-in /// processing for two-way voice communication. @@ -206,16 +206,16 @@ impl PortDesc { pub fn is_spatial_audio_enabled(&self) -> bool; #[objc::msg_send(channels)] - pub fn channels(&self) -> Option<&ns::Array>; + pub fn channels(&self) -> Option>>; #[objc::msg_send(dataSources)] - pub fn data_srcs(&self) -> Option<&ns::Array>; + pub fn data_srcs(&self) -> Option>>; #[objc::msg_send(selectedDataSource)] - pub fn selected_data_src(&self) -> Option<&DataSrcDesc>; + pub fn selected_data_src(&self) -> Option>; #[objc::msg_send(preferredDataSource)] - pub fn preferred_data_src(&self) -> Option<&DataSrcDesc>; + pub fn preferred_data_src(&self) -> Option>; #[objc::msg_send(setPreferredDataSource:error:)] pub unsafe fn set_preferred_data_src_err<'ear>( @@ -236,8 +236,8 @@ define_obj_type!( impl RouteDesc { #[objc::msg_send(inputs)] - pub fn inputs(&self) -> &ns::Array; + pub fn inputs(&self) -> arc::R>; #[objc::msg_send(outputs)] - pub fn outputs(&self) -> &ns::Array; + pub fn outputs(&self) -> arc::R>; } diff --git a/cidre/src/mlc/layer.rs b/cidre/src/mlc/layer.rs index a87b9098..5a87f07c 100644 --- a/cidre/src/mlc/layer.rs +++ b/cidre/src/mlc/layer.rs @@ -1,12 +1,15 @@ -use crate::{define_obj_type, mlc, ns, objc}; +use crate::{arc, define_obj_type, mlc, ns, objc}; -define_obj_type!(pub Layer(ns::Id)); +define_obj_type!( + #[doc(alias = "MLCLayer")] + pub Layer(ns::Id) +); impl Layer { #[objc::msg_send(layerID)] pub fn layer_id(&self) -> usize; #[objc::msg_send(label)] - pub fn label(&self) -> &ns::String; + pub fn label(&self) -> arc::R; #[objc::msg_send(setLabel:)] pub fn set_label(&mut self, val: &ns::String); diff --git a/cidre/src/mlc/tensor.rs b/cidre/src/mlc/tensor.rs index 61b86ddd..efcdfde9 100644 --- a/cidre/src/mlc/tensor.rs +++ b/cidre/src/mlc/tensor.rs @@ -11,13 +11,13 @@ impl Tensor { pub fn tensor_id(&self) -> usize; #[objc::msg_send(descriptor)] - pub fn desc(&self) -> &mlc::TensorDesc; + pub fn desc(&self) -> arc::R; #[objc::msg_send(data)] - pub fn data(&self) -> Option<&ns::Data>; + pub fn data(&self) -> Option>; #[objc::msg_send(label)] - pub fn label(&self) -> &ns::String; + pub fn label(&self) -> arc::R; #[objc::msg_send(setLabel:)] pub fn set_label(&mut self, val: &ns::String); diff --git a/cidre/src/mtl/compute_command_encoder.rs b/cidre/src/mtl/compute_command_encoder.rs index 0f976bbc..406d3615 100644 --- a/cidre/src/mtl/compute_command_encoder.rs +++ b/cidre/src/mtl/compute_command_encoder.rs @@ -1,6 +1,9 @@ use crate::{define_mtl, define_obj_type, mtl, ns, objc}; -define_obj_type!(pub ComputeCmdEncoder(mtl::CmdEncoder)); +define_obj_type!( + #[doc(alias = "MTLComputeCommandEncoder")] + pub ComputeCmdEncoder(mtl::CmdEncoder) +); impl ComputeCmdEncoder { define_mtl!( diff --git a/cidre/src/ns/range.rs b/cidre/src/ns/range.rs index 56d9de99..61ce58c6 100644 --- a/cidre/src/ns/range.rs +++ b/cidre/src/ns/range.rs @@ -10,13 +10,13 @@ pub struct Range { impl Range { #[inline] - pub fn new(loc: ns::UInteger, len: ns::UInteger) -> Self { + pub const fn new(loc: ns::UInteger, len: ns::UInteger) -> Self { Self { loc, len } } #[doc(alias = "NSMaxRange")] #[inline] - pub fn max(&self) -> ns::UInteger { + pub const fn max(&self) -> ns::UInteger { self.loc + self.len } @@ -46,7 +46,7 @@ impl Range { /// ``` #[doc(alias = "NSLocationInRange")] #[inline] - pub fn loc_in_range(location: ns::UInteger, range: &Self) -> bool { + pub const fn loc_in_range(location: ns::UInteger, range: &Self) -> bool { location >= range.loc && (location - range.loc) < range.len } @@ -58,7 +58,7 @@ impl Range { /// assert!(!a.contains(10)); /// ``` #[inline] - pub fn contains(&self, location: ns::UInteger) -> bool { + pub const fn contains(&self, location: ns::UInteger) -> bool { Range::loc_in_range(location, self) } }