tmerr / i3ipc-rs

A Rust library for controlling i3-wm through its IPC interface
MIT License
106 stars 33 forks source link

pub trait for UnixStream #4

Closed bpostlethwaite closed 7 years ago

bpostlethwaite commented 7 years ago

I could utilize the code: https://github.com/tmerr/i3ipc-rs/blob/master/src/lib.rs#L123 in my own project. Any chance you are willing to make that trait public?

It's only a bit of code and I have already copied the interesting bits but seen as I am already using this library sharing those methods would be nice.

tmerr commented 7 years ago

Possibly, what is the use case?

bpostlethwaite commented 7 years ago

The UnixStream trait implementation in i3ipc-rs is fairly general and should work for other modules that need to implement their own serialization and deserialization and also send ints and &str on a stream. The latter part is general to i3ipc and should be easy to share.

The particular use case is an i3bar clone in Rust https://github.com/bpostlethwaite/rubar (eventually this will be several modules r3bar r3msg r3sensors etc). r3bar uses i3ipc-rs for the the workspace switching buttons. However to communicate with the status bar more generally it uses a superset i3ipc protocol in both server and client modes ("talking" i3ipc on msgtypes outside of the i3 band). That part implements the code in i3ipc-rs's UnixStream trait.

Admittedly this is not a huge value add as it is a small amount of straightforward code that won't likely change. Still I would rather reuse than rewrite.

tmerr commented 7 years ago

Sorry for the delay. I am leaning toward no for this one, because I don't think enough people will use this to justify the deviation from the goal of the library, which is to abstract such things to make it easy to use. That said if anyone else would be interested in seeing this exposed, I would be willing to reconsider. For now I will be conservative since it is much harder to remove features than add them. Once again, it's a tough call, and thank you for bringing up this possible use case!

bpostlethwaite commented 7 years ago

No problems, thanks for the consideration.