diff --git a/objc2-foundation/src/macros.rs b/objc2-foundation/src/macros.rs index fbbb2a0b9..18599beba 100644 --- a/objc2-foundation/src/macros.rs +++ b/objc2-foundation/src/macros.rs @@ -295,8 +295,8 @@ macro_rules! __def_fn { // some of that specialization though! {} => {}; { - #[sel($($sel:tt)+)] $(#[$m:meta])* + #sel!($($sel:tt)+) $v:vis fn $name:ident( $(&$self:ident)? $(&mut $mut_self:ident)? @@ -329,8 +329,8 @@ macro_rules! __def_fn { } }; { - #[sel($($sel:tt)+)] $(#[$m:meta])* + #sel!($($sel:tt)+) $v:vis fn $name:ident( $(&$self:ident)? $(&mut $mut_self:ident)? @@ -363,8 +363,8 @@ macro_rules! __def_fn { } }; { - #[sel($($sel:tt)+)] $(#[$m:meta])* + #sel!($($sel:tt)+) $v:vis fn $name:ident( $(&$self:ident)? $(&mut $mut_self:ident)? @@ -397,8 +397,8 @@ macro_rules! __def_fn { } }; { - #[sel($($sel:tt)+)] $(#[$m:meta])* + #sel!($($sel:tt)+) $v:vis fn $name:ident( $(&$self:ident)? $(&mut $mut_self:ident)? diff --git a/objc2-foundation/src/mutable_string.rs b/objc2-foundation/src/mutable_string.rs index 5834ff556..75ca9eb9a 100644 --- a/objc2-foundation/src/mutable_string.rs +++ b/objc2-foundation/src/mutable_string.rs @@ -14,6 +14,12 @@ extern_class! { /// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutablestring?language=objc). #[derive(PartialEq, Eq, Hash)] unsafe pub struct NSMutableString: NSString, NSObject; + + unsafe impl { + /// Construct an empty [`NSMutableString`]. + #sel!(new) + pub fn new() -> Id; + } } // TODO: SAFETY @@ -22,11 +28,6 @@ unsafe impl Send for NSMutableString {} /// Creating mutable strings. impl NSMutableString { - unsafe_def_fn! { - /// Construct an empty [`NSMutableString`]. - pub fn new -> Owned; - } - /// Creates a new [`NSMutableString`] by copying the given string slice. #[doc(alias = "initWithBytes:length:encoding:")] #[allow(clippy::should_implement_trait)] // Not really sure of a better name diff --git a/objc2-foundation/src/object.rs b/objc2-foundation/src/object.rs index 919633472..7c2adf8b4 100644 --- a/objc2-foundation/src/object.rs +++ b/objc2-foundation/src/object.rs @@ -11,20 +11,20 @@ __inner_extern_class! { unsafe pub struct NSObject<>: Object {} unsafe impl { - #[sel(new)] + #sel!(new) pub fn new() -> Id; - #[sel(hash)] + #sel!(hash) pub fn hash_code(&self) -> usize; - #[sel(isEqual:)] + #sel!(isEqual:) pub fn is_equal(&self, other: &NSObject) -> bool; // TODO: Verify that description always returns a non-null string - #[sel(description)] + #sel!(description) pub fn description(&self) -> Id; - #[sel(isKindOfClass:)] + #sel!(isKindOfClass:) pub fn is_kind_of(&self, cls: &Class) -> bool; } }