@@ -5,23 +5,6 @@ use objc2::kind::RetainableKind;
5
5
use crate :: common:: * ;
6
6
use crate :: Foundation :: { self , NSCopying , NSMutableCopying } ;
7
7
8
- // Copying collections is done as a shallow copy.
9
- //
10
- // As such, it is only possible when the array's contents are retainable.
11
- //
12
- // TODO: Depending on what we allow on collections, we might be able to relax
13
- // this to `CloneableKind` (and allowing `NSString`).
14
-
15
- // Arrays
16
-
17
- #[ cfg( feature = "Foundation_NSArray" ) ]
18
- unsafe impl < T : Message > NSCopying for Foundation :: NSArray < T > where T :: Kind : RetainableKind { }
19
-
20
- /// This is implemented as a shallow copy.
21
- #[ cfg( feature = "Foundation_NSArray" ) ]
22
- #[ cfg( feature = "Foundation_NSMutableArray" ) ]
23
- unsafe impl < T : Message > NSMutableCopying for Foundation :: NSArray < T > where T :: Kind : RetainableKind { }
24
-
25
8
#[ cfg( feature = "Foundation_NSArray" ) ]
26
9
impl < T : Message > ToOwned for Foundation :: NSArray < T >
27
10
where
33
16
}
34
17
}
35
18
36
- /// This is implemented as a shallow copy.
37
- #[ cfg( feature = "Foundation_NSMutableArray" ) ]
38
- unsafe impl < T : Message > NSCopying for Foundation :: NSMutableArray < T > where T :: Kind : RetainableKind { }
39
-
40
- /// This is implemented as a shallow copy.
41
- #[ cfg( feature = "Foundation_NSMutableArray" ) ]
42
- unsafe impl < T : Message > NSMutableCopying for Foundation :: NSMutableArray < T > where
43
- T :: Kind : RetainableKind
44
- {
45
- }
46
-
47
19
#[ cfg( feature = "Foundation_NSMutableArray" ) ]
48
20
impl < T : Message > ToOwned for Foundation :: NSMutableArray < T >
49
21
where
55
27
}
56
28
}
57
29
58
- // Data
59
-
60
- #[ cfg( feature = "Foundation_NSData" ) ]
61
- unsafe impl NSCopying for Foundation :: NSData { }
62
-
63
- #[ cfg( feature = "Foundation_NSData" ) ]
64
- #[ cfg( feature = "Foundation_NSMutableData" ) ]
65
- unsafe impl NSMutableCopying for Foundation :: NSData { }
66
-
67
30
#[ cfg( feature = "Foundation_NSData" ) ]
68
31
impl ToOwned for Foundation :: NSData {
69
32
type Owned = Id < Self > ;
@@ -72,12 +35,6 @@ impl ToOwned for Foundation::NSData {
72
35
}
73
36
}
74
37
75
- #[ cfg( feature = "Foundation_NSMutableData" ) ]
76
- unsafe impl NSCopying for Foundation :: NSMutableData { }
77
-
78
- #[ cfg( feature = "Foundation_NSMutableData" ) ]
79
- unsafe impl NSMutableCopying for Foundation :: NSMutableData { }
80
-
81
38
#[ cfg( feature = "Foundation_NSMutableData" ) ]
82
39
impl ToOwned for Foundation :: NSMutableData {
83
40
type Owned = Id < Self > ;
@@ -86,14 +43,6 @@ impl ToOwned for Foundation::NSMutableData {
86
43
}
87
44
}
88
45
89
- // Errors
90
-
91
- #[ cfg( feature = "Foundation_NSError" ) ]
92
- unsafe impl NSCopying for Foundation :: NSError { }
93
-
94
- #[ cfg( feature = "Foundation_NSException" ) ]
95
- unsafe impl NSCopying for Foundation :: NSException { }
96
-
97
46
#[ cfg( feature = "Foundation_NSException" ) ]
98
47
impl ToOwned for Foundation :: NSException {
99
48
type Owned = Id < Self > ;
@@ -102,15 +51,6 @@ impl ToOwned for Foundation::NSException {
102
51
}
103
52
}
104
53
105
- // Sets
106
-
107
- #[ cfg( feature = "Foundation_NSSet" ) ]
108
- unsafe impl < T : Message > NSCopying for Foundation :: NSSet < T > where T :: Kind : RetainableKind { }
109
-
110
- #[ cfg( feature = "Foundation_NSSet" ) ]
111
- #[ cfg( feature = "Foundation_NSMutableSet" ) ]
112
- unsafe impl < T : Message > NSMutableCopying for Foundation :: NSSet < T > where T :: Kind : RetainableKind { }
113
-
114
54
#[ cfg( feature = "Foundation_NSSet" ) ]
115
55
impl < T : Message > ToOwned for Foundation :: NSSet < T >
116
56
where
@@ -122,15 +62,6 @@ where
122
62
}
123
63
}
124
64
125
- #[ cfg( feature = "Foundation_NSMutableSet" ) ]
126
- unsafe impl < T : Message > NSCopying for Foundation :: NSMutableSet < T > where T :: Kind : RetainableKind { }
127
-
128
- #[ cfg( feature = "Foundation_NSMutableSet" ) ]
129
- unsafe impl < T : Message > NSMutableCopying for Foundation :: NSMutableSet < T > where
130
- T :: Kind : RetainableKind
131
- {
132
- }
133
-
134
65
#[ cfg( feature = "Foundation_NSMutableSet" ) ]
135
66
impl < T : Message > ToOwned for Foundation :: NSMutableSet < T >
136
67
where
@@ -142,15 +73,6 @@ where
142
73
}
143
74
}
144
75
145
- // Strings
146
-
147
- #[ cfg( feature = "Foundation_NSString" ) ]
148
- unsafe impl NSCopying for Foundation :: NSString { }
149
-
150
- #[ cfg( feature = "Foundation_NSString" ) ]
151
- #[ cfg( feature = "Foundation_NSMutableString" ) ]
152
- unsafe impl NSMutableCopying for Foundation :: NSString { }
153
-
154
76
#[ cfg( feature = "Foundation_NSString" ) ]
155
77
impl ToOwned for Foundation :: NSString {
156
78
type Owned = Id < Self > ;
@@ -159,12 +81,6 @@ impl ToOwned for Foundation::NSString {
159
81
}
160
82
}
161
83
162
- #[ cfg( feature = "Foundation_NSMutableString" ) ]
163
- unsafe impl NSCopying for Foundation :: NSMutableString { }
164
-
165
- #[ cfg( feature = "Foundation_NSMutableString" ) ]
166
- unsafe impl NSMutableCopying for Foundation :: NSMutableString { }
167
-
168
84
#[ cfg( feature = "Foundation_NSMutableString" ) ]
169
85
impl ToOwned for Foundation :: NSMutableString {
170
86
type Owned = Id < Self > ;
@@ -173,13 +89,6 @@ impl ToOwned for Foundation::NSMutableString {
173
89
}
174
90
}
175
91
176
- #[ cfg( feature = "Foundation_NSAttributedString" ) ]
177
- unsafe impl NSCopying for Foundation :: NSAttributedString { }
178
-
179
- #[ cfg( feature = "Foundation_NSAttributedString" ) ]
180
- #[ cfg( feature = "Foundation_NSMutableAttributedString" ) ]
181
- unsafe impl NSMutableCopying for Foundation :: NSAttributedString { }
182
-
183
92
#[ cfg( feature = "Foundation_NSAttributedString" ) ]
184
93
impl ToOwned for Foundation :: NSAttributedString {
185
94
type Owned = Id < Self > ;
@@ -188,12 +97,6 @@ impl ToOwned for Foundation::NSAttributedString {
188
97
}
189
98
}
190
99
191
- #[ cfg( feature = "Foundation_NSMutableAttributedString" ) ]
192
- unsafe impl NSCopying for Foundation :: NSMutableAttributedString { }
193
-
194
- #[ cfg( feature = "Foundation_NSMutableAttributedString" ) ]
195
- unsafe impl NSMutableCopying for Foundation :: NSMutableAttributedString { }
196
-
197
100
#[ cfg( feature = "Foundation_NSMutableAttributedString" ) ]
198
101
impl ToOwned for Foundation :: NSMutableAttributedString {
199
102
type Owned = Id < Self > ;
@@ -202,11 +105,6 @@ impl ToOwned for Foundation::NSMutableAttributedString {
202
105
}
203
106
}
204
107
205
- // UUID
206
-
207
- #[ cfg( feature = "Foundation_NSUUID" ) ]
208
- unsafe impl NSCopying for Foundation :: NSUUID { }
209
-
210
108
#[ cfg( feature = "Foundation_NSUUID" ) ]
211
109
impl ToOwned for Foundation :: NSUUID {
212
110
type Owned = Id < Self > ;
@@ -215,11 +113,6 @@ impl ToOwned for Foundation::NSUUID {
215
113
}
216
114
}
217
115
218
- // Value
219
-
220
- #[ cfg( feature = "Foundation_NSValue" ) ]
221
- unsafe impl NSCopying for Foundation :: NSValue { }
222
-
223
116
#[ cfg( feature = "Foundation_NSValue" ) ]
224
117
impl ToOwned for Foundation :: NSValue {
225
118
type Owned = Id < Self > ;
@@ -228,9 +121,6 @@ impl ToOwned for Foundation::NSValue {
228
121
}
229
122
}
230
123
231
- #[ cfg( feature = "Foundation_NSNumber" ) ]
232
- unsafe impl NSCopying for Foundation :: NSNumber { }
233
-
234
124
#[ cfg( feature = "Foundation_NSNumber" ) ]
235
125
impl ToOwned for Foundation :: NSNumber {
236
126
type Owned = Id < Self > ;
0 commit comments