Skip to content

Commit

Permalink
Make SliceId a supertrait of SliceIdMut
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Oct 15, 2021
1 parent 3cf4216 commit defd01b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions objc2/src/rc/id_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ pub trait SliceId {
}

/// Helper trait for functionality on slices containing owned [`Id`]s.
pub trait SliceIdMut {
/// The type of the items in the slice.
type Item;

pub trait SliceIdMut: SliceId {
/// Convert a mutable slice of mutable [`Id`]s into a mutable slice of
/// mutable references.
fn as_mut_slice_mut(&mut self) -> &mut [&mut Self::Item];
Expand All @@ -44,8 +41,6 @@ impl<T: Message, O: Ownership> SliceId for [Id<T, O>] {
}

impl<T: Message> SliceIdMut for [Id<T, Owned>] {
type Item = T;

fn as_mut_slice_mut(&mut self) -> &mut [&mut T] {
let ptr = self as *mut Self as *mut [&mut T];
// SAFETY: Id<T, O> and &mut T have the same memory layout, and the
Expand Down

0 comments on commit defd01b

Please sign in to comment.