This PR removes the 'static bound from the Event trait. World::send can now send events containing borrowed data from outside the World. However, Sender::send still requires 'static.
Additional Changes
Removed World::send_many. I wasn't sure how to make the lifetimes correct here, and the method doesn't have any real benefits until #4 or #5 is implemented. It could be added again if needed.
Added Event::This<'a>. Because Event is no longer 'static, we need this associated type in order to get a canonical TypeId. It also resolves a tricky lifetime issue in the implementation of HandlerParam for Receiver/ReceiverMut. This does mean that Event is now an unsafe trait, but it can continue to be implemented safely with the derive macro.
Closes #41
This PR removes the
'static
bound from theEvent
trait.World::send
can now send events containing borrowed data from outside theWorld
. However,Sender::send
still requires'static
.Additional Changes
World::send_many
. I wasn't sure how to make the lifetimes correct here, and the method doesn't have any real benefits until #4 or #5 is implemented. It could be added again if needed.Event::This<'a>
. BecauseEvent
is no longer'static
, we need this associated type in order to get a canonicalTypeId
. It also resolves a tricky lifetime issue in the implementation ofHandlerParam
forReceiver
/ReceiverMut
. This does mean thatEvent
is now anunsafe
trait, but it can continue to be implemented safely with the derive macro.