Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader and Writer should modify value of Option. #327

Open
Frostie314159 opened this issue Mar 25, 2023 · 3 comments
Open

Reader and Writer should modify value of Option. #327

Frostie314159 opened this issue Mar 25, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Frostie314159
Copy link

When using a conditional field, the reader and writer functions should operate on the value of the option. And not the option itself.

@wcampbell0x2a
Copy link
Collaborator

Do you have an example of your expected behavior?

@wcampbell0x2a wcampbell0x2a added the question Further information is requested label Mar 25, 2023
@Frostie314159
Copy link
Author

Frostie314159 commented Mar 25, 2023

Currently I'm trying to parse radiotap headers with deku. Radiotap has a fixed header and the rest of the fields are only present, if their specific bit has been set in the header. Some of these fields are bitflags, for which I've written parser functions. In my struct they are defined as Options: ```
struct header {
//...
#[deku(
cond="present_fields.contains(IEEE80211RadiotapFields::Flags)",
reader = "read_bitflags(deku::rest)",
writer = "write_bitflags(deku::output, &self.present_fields)")]
flags: Option<IEEE80211RadiotapFlags>,
//...
}

@sharksforarms
Copy link
Owner

I'm not sure I fully understand the question and expected behavior. Can you provide a minimal running example w/ comments which would hilight the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants