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

deku::input is unusable #324

Closed
wcampbell0x2a opened this issue Mar 8, 2023 · 1 comment
Closed

deku::input is unusable #324

wcampbell0x2a opened this issue Mar 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@wcampbell0x2a
Copy link
Collaborator

Unless I am missing something, deku::input is not usable as read(..) never has __deku_input and DekuRead will always generate read(..)

use deku::bitvec::{BitSlice, Msb0};
use deku::prelude::*;

#[derive(DekuRead, Debug, PartialEq, Eq)]
struct Block {
    #[deku(assert_eq = "deku::input.1 as u8")]
    a: u8,
    #[deku(count = "deku::input.1 as u8")]
    b: Vec<u8>,
}

#[derive(DekuRead, Debug, PartialEq, Eq)]
#[deku(ctx = "a: u8")]
struct BlockB {
    #[deku(assert_eq = "deku::input.1 as u8")]
    a: u8,
    #[deku(count = "deku::input.1 as u8")]
    b: Vec<u8>,
}

fn main() {
}
error[E0425]: cannot find value `__deku_input` in this scope
 --> src/main.rs:6:24
  |
6 |     #[deku(assert_eq = "deku::input.1 as u8")]
  |                        ^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `__deku_rest`

error[E0425]: cannot find value `__deku_input` in this scope
 --> src/main.rs:8:20
  |
8 |     #[deku(count = "deku::input.1 as u8")]
  |                    ^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `__deku_rest`

error[E0425]: cannot find value `__deku_input` in this scope
  --> src/main.rs:15:24
   |
15 |     #[deku(assert_eq = "deku::input.1 as u8")]
   |                        ^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `__deku_rest`

error[E0425]: cannot find value `__deku_input` in this scope
  --> src/main.rs:17:20
   |
17 |     #[deku(count = "deku::input.1 as u8")]
   |                    ^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `__deku_rest`
@wcampbell0x2a wcampbell0x2a added the bug Something isn't working label Mar 8, 2023
@wcampbell0x2a
Copy link
Collaborator Author

deku::input was removed with #352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant