Skip to content

Commit 8288312

Browse files
committed
object_struct! macro actually uses a struct, not enum.
1 parent a004f56 commit 8288312

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/macros.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
macro_rules! object_struct {
22
($name:ident) => (
3-
object_struct!($name,);
4-
);
5-
($name:ident<$($t:ident),+>) => (
6-
object_struct!($name, $($t),+);
7-
);
8-
($name:ident, $($t:ident),*) => (
9-
pub enum $name<$($t),*> { }
3+
pub struct $name {
4+
_private: (),
5+
}
106

11-
object_impl!($name $(,$t)*);
7+
object_impl!($name);
128

13-
impl<$($t),*> $crate::INSObject for $name<$($t),*> {
9+
impl $crate::INSObject for $name {
1410
fn class() -> &'static ::objc::runtime::Class {
1511
let name = stringify!($name);
1612
match ::objc::runtime::Class::get(name) {
@@ -20,23 +16,23 @@ macro_rules! object_struct {
2016
}
2117
}
2218

23-
impl<$($t),*> ::std::cmp::PartialEq for $name<$($t),*> {
24-
fn eq(&self, other: &$name<$($t),*>) -> bool {
19+
impl ::std::cmp::PartialEq for $name {
20+
fn eq(&self, other: &Self) -> bool {
2521
use $crate::INSObject;
2622
self.is_equal(other)
2723
}
2824
}
2925

30-
impl<$($t),*> ::std::cmp::Eq for $name<$($t),*> { }
26+
impl ::std::cmp::Eq for $name { }
3127

32-
impl<$($t),*> ::std::hash::Hash for $name<$($t),*> {
28+
impl ::std::hash::Hash for $name {
3329
fn hash<H>(&self, state: &mut H) where H: ::std::hash::Hasher {
3430
use $crate::INSObject;
3531
self.hash_code().hash(state);
3632
}
3733
}
3834

39-
impl<$($t),*> ::std::fmt::Debug for $name<$($t),*> {
35+
impl ::std::fmt::Debug for $name {
4036
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
4137
use $crate::{INSObject, INSString};
4238
::std::fmt::Debug::fmt(self.description().as_str(), f)

0 commit comments

Comments
 (0)