Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the lock_api dependency optional. #11

Merged
merged 4 commits into from
Jun 12, 2024

Conversation

sunfishcode
Copy link
Owner

Without lock_api, this crate only provides a small number of types such as RawMutex and RawRwLock, but if someone needs just those, it's reasonable to provide them without depending on lock_api.

This also makes RawMutex and RawRwLock easier to use, because it's no longer necessary to import the lock_api traits with the as _ trick.

Without `lock_api`, this crate only provides a small number of types
such as `RawMutex` and `RawRwLock`, but if someone needs just those,
it's reasonable to provide them without depending on `lock_api`.

This also makes `RawMutex` and `RawRwLock` easier to use, because
it's no longer necessary to import the `lock_api` traits with the `as _`
trick.
@sunfishcode
Copy link
Owner Author

On further reflection, I don't like how this meant that the RawMutex and RawRwLock types would have had undocumented public functions, and I don't want to copy all of lock_api's documentation into rustix-futex-sync. I've now added a patch switching to an approach where rustix-futex-sync uses its own copies of lock_api's traits when the real lock_api is unavailable.

Using a `pub use` instead of a `pub type` alias gives it better
rustdoc documentation.
@sunfishcode sunfishcode merged commit 884a549 into main Jun 12, 2024
5 checks passed
@sunfishcode sunfishcode deleted the sunfishcode/optional-lock-api branch June 12, 2024 14:48
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