#i3 #ipc #protocols #serde #serde-json #json #io-write

i3ipc-types

Library containing all the types needed to communicate with i3, along with their serde implementations and implementations of many std traits

11 breaking releases

0.16.0 Dec 31, 2022
0.15.0 Jul 5, 2022
0.14.0 Dec 10, 2021
0.13.0 Nov 4, 2021
0.5.0 Apr 21, 2019

#2454 in Parser implementations

Download history 62/week @ 2024-07-21 151/week @ 2024-07-28 78/week @ 2024-08-04 80/week @ 2024-08-11 51/week @ 2024-08-18 65/week @ 2024-08-25 40/week @ 2024-09-01 42/week @ 2024-09-08 39/week @ 2024-09-15 109/week @ 2024-09-22 70/week @ 2024-09-29 45/week @ 2024-10-06 52/week @ 2024-10-13 44/week @ 2024-10-20 29/week @ 2024-10-27 47/week @ 2024-11-03

178 downloads per month
Used in 13 crates (4 directly)

MIT license

29KB
733 lines

i3ipc-types

Crate API

This crate includes all the types for interacting with i3ipc, along with some undocumented properties I found by browsing i3's source code. It also includes some basic sway support, though I don't personally use sway so I'm relying on PRs to maintain this feature.

This crate includes the definitions for all i3 ipc message responses, event types, and serialize/deserialize implementations using serde. Additionally, I've included traits with default implementations for encoding and decoding for speaking i3's ipc protocol, so long as the type has implemented io::Read and io::Write.

My goal is to locate all of the type definitions for i3's IPC implementation here, so no one ever has to go through the tedium again. If anything is missing or not working, please fill out an issue or submit a PR, I'm happy to fix things or improve the library in any way I can.

Features

By default this crate will include features for synchronous IO. Using stds io::Read + io::Write

If async-traits is enabled, I3Protocol will be implemented for any trait that implements tokio's AsyncRead + AsyncWrite

Advantages over i3ipc-rs

i3ipc-rs packs the event responses into a single enum, this is wasteful if you intend to receive responses to events for anything except workspaces & windows, since there is no indirection in the type definiton. Rust's memory layout for enums makes each variant take up to the size of the largest variant, that means that responses with relatively few fields like OutputData would take up as much space as WindowData. In this crate, that's not the case. There's a layer of indirection for WorkspaceData and WindowData so that the minimum variant size remains small.

Dependencies

~0.7–12MB
~144K SLoC