@@ -123,33 +123,33 @@ pub trait INSArray : INSObject {
123
123
Id :: from_ptr ( obj as * const Self :: Item as * mut Self :: Item )
124
124
} ) . collect ( )
125
125
}
126
- }
127
126
128
- pub trait INSOwnedArray : INSArray < Own = Owned > {
129
- fn mut_object_at ( & mut self , index : usize ) -> & mut Self :: Item {
127
+ fn mut_object_at ( & mut self , index : usize ) -> & mut Self :: Item
128
+ where Self : INSArray < Own = Owned > {
130
129
unsafe {
131
130
let result: * mut Self :: Item = msg_send ! [ self , objectAtIndex: index] ;
132
131
& mut * result
133
132
}
134
133
}
135
- }
136
134
137
- pub trait INSSharedArray : INSArray < Own = Shared > {
138
- fn shared_object_at ( & self , index : usize ) -> ShareId < Self :: Item > {
135
+ fn shared_object_at ( & self , index : usize ) -> ShareId < Self :: Item >
136
+ where Self : INSArray < Own = Shared > {
139
137
let obj = self . object_at ( index) ;
140
138
unsafe {
141
139
Id :: from_ptr ( obj as * const _ as * mut Self :: Item )
142
140
}
143
141
}
144
142
145
- fn from_slice ( slice : & [ ShareId < Self :: Item > ] ) -> Id < Self > {
143
+ fn from_slice ( slice : & [ ShareId < Self :: Item > ] ) -> Id < Self >
144
+ where Self : INSArray < Own =Shared > {
146
145
let refs: Vec < & Self :: Item > = slice. iter ( ) . map ( |obj| & * * obj) . collect ( ) ;
147
146
unsafe {
148
147
INSArray :: from_refs ( & refs)
149
148
}
150
149
}
151
150
152
- fn to_shared_vec ( & self ) -> Vec < ShareId < Self :: Item > > {
151
+ fn to_shared_vec ( & self ) -> Vec < ShareId < Self :: Item > >
152
+ where Self : INSArray < Own =Shared > {
153
153
self . to_vec ( ) . into_iter ( ) . map ( |obj| unsafe {
154
154
Id :: from_ptr ( obj as * const Self :: Item as * mut Self :: Item )
155
155
} ) . collect ( )
@@ -173,10 +173,6 @@ impl<T, O> INSArray for NSArray<T, O> where T: INSObject, O: Ownership {
173
173
type Own = O ;
174
174
}
175
175
176
- impl < T > INSOwnedArray for NSArray < T , Owned > where T : INSObject { }
177
-
178
- impl < T > INSSharedArray for NSArray < T , Shared > where T : INSObject { }
179
-
180
176
impl < T > INSCopying for NSArray < T , Shared > where T : INSObject {
181
177
type Output = NSSharedArray < T > ;
182
178
}
@@ -288,10 +284,6 @@ impl<T, O> INSArray for NSMutableArray<T, O> where T: INSObject, O: Ownership {
288
284
type Own = O ;
289
285
}
290
286
291
- impl < T > INSOwnedArray for NSMutableArray < T , Owned > where T : INSObject { }
292
-
293
- impl < T > INSSharedArray for NSMutableArray < T , Shared > where T : INSObject { }
294
-
295
287
impl < T , O > INSMutableArray for NSMutableArray < T , O >
296
288
where T : INSObject , O : Ownership { }
297
289
0 commit comments