Closed Susurrus closed 7 years ago
I don't think the 2 crates can be compared. nix
is a huge beast, powerful but also difficult to audit. termios-rs
on the other hand is less powerful but easy to audit because of its small size.
Seems like both use MIT licensing though, so that would make deprecation easy.
I've just noticed that libc
now includes all of termios-rs
and it's unit testing for a lot of different OSes. For instance, for TCSANOW
, see: https://github.com/rust-lang/libc/search?utf8=%E2%9C%93&q=TCSANOW&type=
This is nix
uses under the hood, I believe.
@conradkdotcom Yes, I finished adding support for the termios
API to nix
(which included pushing all FFI declarations into libc
) because I wanted to have solid cross-platform support for it. The CI story for both libc
and nix
are both very good. Additionally nix
aims to support all POSIX platforms also supported by libc
(see the README for platform support promises).
I don't think the 2 crates can be compared. nix is a huge beast, powerful but also difficult to audit. termios-rs on the other hand is less powerful but easy to audit because of its small size.
nix
is a bunch of disparate APIs that share very little code, so I don't think yours is an appropriate characterization. If you look at the code for the termios API you'll actually see it only builds on 3 datatypes defined by nix
: Pid
, Result
, and Error
. Auditing this codebase should be no more onerous than that of termios-rs
given that tokei
reports the LoC for both projects' APIs to be very similar.
I don't see any reason to deprecate termios-rs
. It requires very little maintenance and has fewer dependencies than nix
, which some people might prefer.
Some developers (such as myself) consider the cost (in terms of complexity and maintenance) before adding a dependency to a project. For those developers, less is more, and termios-rs
offers a simple API that's focused on a single piece of POSIX functionality and has only libc
as a dependency. Some developers see dependencies as a near-zero cost to their project. For them (or in some circumstances such as prototyping), the extra surface area and transitive dependencies of nix
might not be a big deal.
It's nice to have choices.
@conradkdotcom Thanks for pointing out that libc
has the termios definitions now. I may actually switch serial-rs
to use that instead to reduce dependencies.
The new
nix
0.9 release includes a new termios API that covers the same functionality provided by this crate. Depending on your workload, it might be worth deprecating this crate and stating that people should usenix
directly instead.