Closed muja closed 1 year ago
I don't know if this is the actual problem, but it doesn't look like #[borrows(entry_reader)]
is correct for reader
; the EventReader
type owns the parameter, and doesn't borrow it, so it must be borrowing from elsewhere than the entry_reader
field (presumably file
).
Looks like this is a problem with the internal generation of the BorrowedFields
struct, it should contain a bound that 'this
outlives 'outer_borrow
, but it was missing. This is now fixed in 0.17.2
I don't know if this is the actual problem, but it doesn't look like
#[borrows(entry_reader)]
is correct forreader
; theEventReader
type owns the parameter, and doesn't borrow it, so it must be borrowing from elsewhere than theentry_reader
field (presumablyfile
).
Yes that's a valid concern but in this stage the compiler doesn't know from the struct signature that there is no practicable to obtain an owned EntryReader
from a borrowed one. So that couldn't be it. And, I actually tried multiple different variants, just ended up with this otherwise-faulty one :)
@joshua-maros thank you so much, it works now. I tried all weekend to get this to work and was really desparate!
Hi, I have the following solution for a use case: write a container that represents an MS Word (docx) file. A docx file is just a zip archive with a dozen XML files. I've tried a lot of different solutions and this is where I've landed, but it won't compile: owned file with a zip
Archive
struct struct borrowing the file, aZipReader
borrowing theArchive
and aXMLReader
borrowing theZipReader
The error I'm getting:
Notes: I'm using
xml-rs
crate for XML reading and for ZIP I'm usingrc_zip
crate from my main branch: https://github.com/muja/rc-zipAny idea what I'm doing wrong?