Replies: 1 comment 1 reply
-
Some notes:
For example, passing | #[derive(Debug, PartialEq, DekuRead)]
| ^^^^^^^^ expected `u8`, found `Endian`
|
= note: this error originates in the derive macro `DekuRead` (in Nightly builds, run with -Z macro-backtrace for more info) |
23 | #[deku(ctx = "(1u8, Limit::from(10), Endian::Little)")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Limit<u8, _>`, found `(u8, Limit<_, fn(&_) -> bool>, Endian)`
|
= note: expected enum `Limit<u8, _>`
found tuple `(u8, Limit<_, for<'a> fn(&'a _) -> bool>, Endian)` 19 | #[derive(Debug, PartialEq, DekuRead)]
| ^^^^^^^^
| |
| expected a tuple with 3 elements, found one with 2 elements
| arguments to this function are incorrect
|
= note: expected tuple `(u8, Limit<u8, _>, Endian)`
found tuple `(u8, Limit<u8, _>)` cargo-expand revealed following call in let __deku_value = <PublicCompressedData as ::deku::DekuReader<
'_,
_,
>>::from_reader_with_ctx(
__deku_reader,
(
::deku::ctx::Endian::Little,
(Endian::Little, Limit::from(10), 1u8),
),
)?; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have custom reader and writer to (de-)compress data and assert/write additional information. Compression requires passing at least
u8
to specify at compression level.I can use
reader
andwriter
attributes, but I prefer to implementDekuReader
andDekuWriter
interfaces.Currently I've done following (DekuWriter is the same, but writing data in reverse)
DekuRead
andDekuWrite
Vec<u8>
as public interfaceDekuRead
andDekuWrite
with default settingsI was unable to pass an additional parameters using custom context data.
my code for structure and reader follows below, writer is quite similar, but in reverse.
ZlibDecoder
/ZlibEncoder
are fromflate2
crate for those who'd like to compile.Notes:
PublicData
doesn't implement directlyDekuRead
andDekuWrite
asVec<u8>
require context containing limit and byte order, but they come from model above (TargetModel
separate code block below).field usage:
Beta Was this translation helpful? Give feedback.
All reactions