diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c6aa81..1383148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Changed +- + +## [0.3.2][] - 2024-01-14 + +### Added + +- Add `Clone` and `Copy` implementations for `InterchangeRef`. ## [0.3.1][] - 2024-06-20 @@ -35,7 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changes API to use references instead of moves. This improves stack usage. -[Unreleased]: https://github.com/trussed-dev/interchange/compare/0.3.1...HEAD +[Unreleased]: https://github.com/trussed-dev/interchange/compare/0.3.2...HEAD +[0.3.2]: https://github.com/trussed-dev/interchange/compare/0.3.1...0.3.2 [0.3.1]: https://github.com/trussed-dev/interchange/compare/0.3.0...0.3.1 [0.3.0]: https://github.com/trussed-dev/interchange/compare/0.2.2...0.3.0 [0.2.2]: https://github.com/trussed-dev/interchange/compare/0.2.0...0.2.2 diff --git a/Cargo.toml b/Cargo.toml index 1f92965..9ffb319 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "interchange" -version = "0.3.1" +version = "0.3.2" authors = ["The Trussed developers", "Nicolas Stalder "] edition = "2018" description = "Request/response mechanism for embedded development, using atomics" diff --git a/src/lib.rs b/src/lib.rs index 6af9676..3f062ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -941,6 +941,7 @@ pub struct InterchangeRef<'alloc, Rq, Rp> { channels: &'alloc [Channel], last_claimed: &'alloc AtomicUsize, } + impl<'alloc, Rq, Rp> InterchangeRef<'alloc, Rq, Rp> { /// Claim one of the channels of the interchange. Returns None if called more than `N` times. pub fn claim(&self) -> Option<(Requester<'alloc, Rq, Rp>, Responder<'alloc, Rq, Rp>)> { @@ -964,6 +965,14 @@ impl<'alloc, Rq, Rp> InterchangeRef<'alloc, Rq, Rp> { } } +impl Clone for InterchangeRef<'_, Rq, Rp> { + fn clone(&self) -> Self { + *self + } +} + +impl Copy for InterchangeRef<'_, Rq, Rp> {} + impl Default for Interchange { fn default() -> Self { Self::new()