Currently, you can only pass 'static readers/writers into the demo readers/writers.
This works for Files, but not for writing into Vec<u8>.
As we require io::Seek for both reader and writer, we would not write into Vec<u8> directly, but a Cursor<&mut Vec<u8>> should work.
Why RFC
I'm not sure about the implications of this change.
Introducing a lifetime typically makes using it more difficult.
This is apparent with the lifetime issues that arose.
Issues
New lifetime issues which I wasn't able to solve, I guess I disagree with the compiler on some level.
Weird lifetime issue in tools/demo_read_write.
Lifetime issue in tools/teehistorian2demo, where I tried to actually write into a Cursor<Vec<u8>>. (I also tried Cursor<&mut Vec<u8>> and that didn't work either.
The suggested changes solved all the issues :+1:
This change did not require any changes in tools.
It should only lessen the restriction on the parameter (and make the code a little more complicated).
Problem I want to solve
Currently, you can only pass
'static
readers/writers into the demo readers/writers. This works forFile
s, but not for writing intoVec<u8>
. As we requireio::Seek
for both reader and writer, we would not write intoVec<u8>
directly, but aCursor<&mut Vec<u8>>
should work.Why RFC
I'm not sure about the implications of this change. Introducing a lifetime typically makes using it more difficult. This is apparent with the lifetime issues that arose.
Issues
New lifetime issues which I wasn't able to solve, I guess I disagree with the compiler on some level.
tools/demo_read_write
.tools/teehistorian2demo
, where I tried to actually write into aCursor<Vec<u8>>
. (I also triedCursor<&mut Vec<u8>>
and that didn't work either.