You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a Sink has two sub sinks MapSink and SeqSink which are returned from map and seq respectively. The challenge with these is that their lifetime has to be constrained to the sink itself which means that the MapSink and SeqSink returned can't reference data which is not on &mut self.
This seems like a non issue but actually is problematic for where a in direction is needed during deserialization. For greater flexibility our Deserialize::deserialize_into method returns a SinkHandle which can also contain a boxed Sink. This means that the following piece of code does not work:
The challenge now is how does one come up with a better design which retains the general usefulness of the SinkHandle. Currently this complexity is largely pushed into the highly unsafe internals of the Driver but for quite a few sinks this complexity is resurfacing. What's worse though is that there is really no safe way in which one can fulfill the contract of a MapSink + '_ while holding on to a SinkHandle::Owned without violating some rules.
The text was updated successfully, but these errors were encountered:
I definitely can't come up with a better solution here. However thankfully the problem turns out to be not massive thankfully as one can just return an alternative sink upon deserialization that wraps the entire sink handle.
This is an example of how this is done for optionals now: 9c8efc9
Currently a
Sink
has two sub sinksMapSink
andSeqSink
which are returned frommap
andseq
respectively. The challenge with these is that their lifetime has to be constrained to the sink itself which means that theMapSink
andSeqSink
returned can't reference data which is not on&mut self
.This seems like a non issue but actually is problematic for where a in direction is needed during deserialization. For greater flexibility our
Deserialize::deserialize_into
method returns aSinkHandle
which can also contain a boxedSink
. This means that the following piece of code does not work:This fails as
deserialize_into
when it returns aSinkHandle::Owned
cannot be held on to. The following code would compile:The challenge now is how does one come up with a better design which retains the general usefulness of the
SinkHandle
. Currently this complexity is largely pushed into the highly unsafe internals of theDriver
but for quite a few sinks this complexity is resurfacing. What's worse though is that there is really no safe way in which one can fulfill the contract of aMapSink + '_
while holding on to aSinkHandle::Owned
without violating some rules.The text was updated successfully, but these errors were encountered: