leshow/tokio-i3ipc

deserialization error

ExpandingMan opened this issue · 1 comments

I'm getting an error any time I try talking to i3.

◖▮~▮◗ i3 --version
i3 version 4.20.1 (2021-11-03) © 2009 Michael Stapelberg and contributors

If I try running

fn main() -> io::Result<()> {
    let mut i3 = I3::connect()?;

    let ws = i3.get_workspaces()?;

    println!("{:#?}", ws);

    Ok(())
}

I get

Error: Custom { kind: InvalidData, error: Error("invalid value: integer `-1`, expected usize", line: 1, column: 183) }

After further investigation, this seems to be originating from the Workspace.num field. i3ipc takes this as usize but it is possible for i3 to give negative integers. This seems to be accounted for in Node but not Workspace.