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
It makes sense! Ultimately, putting a default_on_eof in a nested struct and then defining other mandatory fields on the parent struct is similar to adding a default_on_eof on a field that's not the last.
In this particular example (not the smallest repro) of a buffer being read from: &[1, 0, 0, 0, 0xAA, 2, 0, 0]:
enum tag (Second)
u8 (a: 0xAA)
u8 (length: 2)
Vec (data: vec![0, 0])
EOF
The reader was expecting a RangeInclusive<u8> at this point, but there's nothing because it read the bytes into the Vec<u8>.
I'm not sure what the solution is here. I don't think there's any way for speedy to do the correct thing. I'm also not sure there's a way to disallow nesting a struct that has default_on_eof without it being the last field of the parent struct. If there is, that might throw a helpful error to the user.
The text was updated successfully, but these errors were encountered:
I had been scratching my head at a
default_on_eof
not working (error: eof) and was finally able to reproduce.It makes sense! Ultimately, putting a
default_on_eof
in a nested struct and then defining other mandatory fields on the parent struct is similar to adding adefault_on_eof
on a field that's not the last.In this particular example (not the smallest repro) of a buffer being read from:
&[1, 0, 0, 0, 0xAA, 2, 0, 0]
:Second
)a: 0xAA
)length: 2
)data: vec![0, 0]
)The reader was expecting a
RangeInclusive<u8>
at this point, but there's nothing because it read the bytes into theVec<u8>
.I'm not sure what the solution is here. I don't think there's any way for
speedy
to do the correct thing. I'm also not sure there's a way to disallow nesting a struct that hasdefault_on_eof
without it being the last field of the parent struct. If there is, that might throw a helpful error to the user.The text was updated successfully, but these errors were encountered: