Skip to content

Bump mutex crate version #14

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

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions source/mutex-traits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ Compared to the more general traits provided by the [`lock_api`] crate, these
traits are aimed at being more compatible with implementations based on
critical sections, are easier to work with in a nested or strictly LIFO pattern.

## Versioning, and which crate to use?

The [`mutex-traits`] crate should be used by **library crates** that want to be generic
over different ways of exclusive access.

The [`mutex`] crate should be used by **applications** that need to select which implementation
is appropriate for their use case. The [`mutex`] crate also re-exports the [`mutex-traits`]
crate for convenience, so applications only need to pull in one direct dependency.

While both crates are >= 1.0, it should be expected that it is **MUCH** more likely that [`mutex`]
crate will make breaking changes someday. The hope is that [`mutex-traits`] NEVER releases a 2.0
version, which means that even if there are 1.x, 2.x, 3.x, etc. versions of the [`mutex`] crate,
they all can be used interchangably since they implement the 1.x [`mutex-traits`] interfaces.

If you are a library crate, consider ONLY relying on the [`mutex-traits`] crate directly, and
put any use of the [`mutex`] crate behind a feature flag or in the `dev-dependencies` section.

## Provenance

Portions of this code are forked from the `embassy-sync` crate.
Expand All @@ -46,4 +63,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

[`mutex`]: https://crates.io/crates/mutex
[`mutex-traits`]: https://crates.io/crates/mutex-traits
[`lock_api`]: https://docs.rs/lock_api/
2 changes: 1 addition & 1 deletion source/mutex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mutex"
version = "0.1.0"
version = "1.0.0"
description = "An abstraction over closure-based mutexes"
categories = [
"embedded",
Expand Down
18 changes: 18 additions & 0 deletions source/mutex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@

Mutex implementations using [`mutex-traits`].

## Versioning, and which crate to use?

The [`mutex-traits`] crate should be used by **library crates** that want to be generic
over different ways of exclusive access.

The [`mutex`] crate should be used by **applications** that need to select which implementation
is appropriate for their use case. The [`mutex`] crate also re-exports the [`mutex-traits`]
crate for convenience, so applications only need to pull in one direct dependency.

While both crates are >= 1.0, it should be expected that it is more likely that [`mutex`] crate
will make breaking changes someday. The hope is that [`mutex-traits`] NEVER releases a 2.0
version, which means that even if there are 1.x, 2.x, 3.x, etc. versions of the [`mutex`] crate,
they all can be used interchangably since they implement the 1.x [`mutex-traits`] interfaces.

If you are a library crate, consider ONLY relying on the [`mutex-traits`] crate directly, and
put any use of the [`mutex`] crate behind a feature flag or in the `dev-dependencies` section.

## Crate Feature Flags

The following feature flags enable implementations of
Expand Down Expand Up @@ -49,6 +66,7 @@ functionality other than implementations of [`ScopedRawMutex`]/[`RawMutex`]:
by embedded projects and other use-cases where minimizing binary size is
important.

[`mutex`]: https://crates.io/crates/mutex
[`mutex-traits`]: https://crates.io/crates/mutex-traits
[`critical-section`]: https://crates.io/crates/critical-section
[`lock_api`]: https://crates.io/crates/critical-section
Expand Down
3 changes: 2 additions & 1 deletion source/mutex/src/raw_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

use core::marker::PhantomData;
use core::sync::atomic::{AtomicBool, Ordering};

use mutex_traits::{ConstInit, ScopedRawMutex};

pub use mutex_traits as traits;

#[cfg(feature = "impl-critical-section")]
pub mod cs {
//! Critical Section based implementation
Expand Down
Loading