Module tokio_i3ipc::codec

source ·
Expand description

Implements tokio_codec’s Decoder trait

Using EventCodec to subscribe to event::Event from i3:

use tokio_i3ipc::{event::Subscribe, I3};

#[tokio::main(flavor = "current_thread")]
async fn main() -> io::Result<()> {
    let mut i3 = I3::connect().await?;
    i3.subscribe([Subscribe::Window]).await?;

    let mut listener = i3.listen();
    while let Some(event) = listener.next().await {
        println!("{:#?}", event);
    }
    Ok(())
}

Structs

This codec only impls Decoder because it’s only job is to read messages from i3 and turn them into frames of Events. All other interactions with i3 over the IPC are simple send/receive operations. Events received will be relative to what was subscribed.