sharksforarms / deku

Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Apache License 2.0
1.05k stars 54 forks source link

`deku::input` is unusable #324

Closed wcampbell0x2a closed 6 months ago

wcampbell0x2a commented 1 year ago

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 commented 6 months ago

deku::input was removed with https://github.com/sharksforarms/deku/pull/352