Skip to content

Commit

Permalink
Allow msg_send_id![obj, init] to non-option wrapped Id
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jun 14, 2022
1 parent a7249a9 commit 75c2f1e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions objc2/src/rc/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ impl<T: ?Sized + Message, O: Ownership> __MsgSendId<Option<Id<Allocated<T>, O>>,
}
}

impl<T: ?Sized + Message, O: Ownership> __MsgSendId<Id<Allocated<T>, O>, Option<Id<T, O>>>
for __Assert<false, true, true>
{
#[inline(always)]
unsafe fn __send_message_id<A: MessageArguments>(
obj: Id<Allocated<T>, O>,
sel: Sel,
args: A,
) -> Result<Option<Id<T, O>>, MessageError> {
let ptr = Id::consume_as_ptr(ManuallyDrop::new(obj));
unsafe { MessageReceiver::send_message(ptr, sel, args).map(|r| Id::new(r)) }
}
}

impl<T: ?Sized + Message, O: Ownership>
__MsgSuperSendId<Id<Allocated<T>, O>, Option<Id<Allocated<T>, O>>>
for __Assert<false, true, true>
Expand Down

0 comments on commit 75c2f1e

Please sign in to comment.