Skip to content

Commit fcbb30c

Browse files
committed
Removed owned and shared array traits.
1 parent 672d382 commit fcbb30c

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/array.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,33 +123,33 @@ pub trait INSArray : INSObject {
123123
Id::from_ptr(obj as *const Self::Item as *mut Self::Item)
124124
}).collect()
125125
}
126-
}
127126

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> {
130129
unsafe {
131130
let result: *mut Self::Item = msg_send![self, objectAtIndex:index];
132131
&mut *result
133132
}
134133
}
135-
}
136134

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> {
139137
let obj = self.object_at(index);
140138
unsafe {
141139
Id::from_ptr(obj as *const _ as *mut Self::Item)
142140
}
143141
}
144142

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> {
146145
let refs: Vec<&Self::Item> = slice.iter().map(|obj| &**obj).collect();
147146
unsafe {
148147
INSArray::from_refs(&refs)
149148
}
150149
}
151150

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> {
153153
self.to_vec().into_iter().map(|obj| unsafe {
154154
Id::from_ptr(obj as *const Self::Item as *mut Self::Item)
155155
}).collect()
@@ -173,10 +173,6 @@ impl<T, O> INSArray for NSArray<T, O> where T: INSObject, O: Ownership {
173173
type Own = O;
174174
}
175175

176-
impl<T> INSOwnedArray for NSArray<T, Owned> where T: INSObject { }
177-
178-
impl<T> INSSharedArray for NSArray<T, Shared> where T: INSObject { }
179-
180176
impl<T> INSCopying for NSArray<T, Shared> where T: INSObject {
181177
type Output = NSSharedArray<T>;
182178
}
@@ -288,10 +284,6 @@ impl<T, O> INSArray for NSMutableArray<T, O> where T: INSObject, O: Ownership {
288284
type Own = O;
289285
}
290286

291-
impl<T> INSOwnedArray for NSMutableArray<T, Owned> where T: INSObject { }
292-
293-
impl<T> INSSharedArray for NSMutableArray<T, Shared> where T: INSObject { }
294-
295287
impl<T, O> INSMutableArray for NSMutableArray<T, O>
296288
where T: INSObject, O: Ownership { }
297289

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate libc;
88
extern crate objc;
99

1010
pub use self::array::{
11-
INSArray, INSMutableArray, INSOwnedArray, INSSharedArray,
11+
INSArray, INSMutableArray,
1212
NSArray, NSComparisonResult, NSMutableArray, NSRange,
1313
NSMutableSharedArray, NSSharedArray,
1414
};

0 commit comments

Comments
 (0)