Skip to content

Comments

Using bindgen to support all platforms#36

Draft
nospam3089 wants to merge 3 commits intodcuddeback:masterfrom
nospam3089:topic/use_bindgen
Draft

Using bindgen to support all platforms#36
nospam3089 wants to merge 3 commits intodcuddeback:masterfrom
nospam3089:topic/use_bindgen

Conversation

@nospam3089
Copy link

The low-maintenance state of this crate is great, but here comes a suggestion for a somewhat disruptive design change which might be worth considering.

One can argue it made more sense to fully handcraft the files in src/os/ back when this termios crate was first written than what is the case today when the available tooling situation is better. The main drawback with handcrafted platform files are that only those explicitly listed platforms are supported. If switching to instead use bindgen, all relevant platforms should be working without the tedious and error prone task of manually translating the header file into Rust. This PR implements such a change, while still maintaining the ::os::* modules as in previous versions for well-known platforms.

The one thing I knowingly didn't bother updating prior to learning your opinion is the CONTRIBUTING.md file. Hence the draft status. If this looks mostly good to you, I'll polish up the documentation too.

Even though making huge structural changes, to the best of my understanding this should not require more than a patch level update to semver versioning since all public interfaces should remain unchanged. That might require a bit more consideration prior to merging though.

Regarding crate naming, I'm hoping we can be able to reach out to @basmith and obtain have the ownership of the seemingly unused and abandoned crate currently holding the termios-sys name. Otherwise libtermios-sys is available. Sorting out crate naming is likely also blocking this to be merged.

Running cargo test succeeds on linux and illumos. The https://git.netizen.se/termios-rs/log/?h=wip/haiku_support branch brings termios-rs to haiku, a platform where it previously refused to build. No other platforms have been attempted by me, yet.

@jgarzik
Copy link

jgarzik commented Mar 6, 2024

  1. conceptually looks nice.

  2. Is it useful to consider an inheritable composition method? Specifically, the following two-stage arrangement is worth considering from my PoV:

a) POSIX definitions
b) OS-specific definitions, inherits and updates POSIX definitions. Essentially a diff from (a), rather than a full list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants