Skip to content

Commit

Permalink
Finish 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Jul 10, 2023
1 parent 392115a commit a25a27d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to this project will be documented in this file.
This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.2.0] - 2023-07-10

### Added

Expand All @@ -16,4 +16,5 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- 🎉 Initial release.

[0.2.0]: https://github.com/sunsided/swap3-rs/releases/tag/0.2.0
[0.1.0]: https://github.com/sunsided/swap3-rs/releases/tag/0.1.0
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "swap3"
version = "0.1.0"
version = "0.2.0"
description = "Swapping of three references, rotating the values left or right"
authors = ["Markus Mayer"]
repository = "https://github.com/sunsided/swap3-rs"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ fn swap3_bca() {
For slices, the `swap3_bca_slice` and `swap3_cab_slice` functions can be used:

```rust
use swap3::prelude::*;

fn swap3_bca() {
let mut vec = vec![10, 20, 30, 40, 50, 60];
swap3::swap3_bca_slice(&mut vec, 0, 1, 4);
vec.swap3_bca(0, 1, 4);
assert_eq!(vec, &[30, 50, 30, 40, 10, 60]);
}
```
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
//! swap3::swap3_bca_slice(&mut vec, 0, 1, 4);
//! assert_eq!(vec, &[20, 50, 30, 40, 10, 60]);
//! ```
//!
//! ... or using the [`Swap3`] trait imported from the prelude:
//!
//! ```
//! use swap3::prelude::*;
//!
//! let mut vec = vec![10, 20, 30, 40, 50, 60];
//! vec.swap3_bca(0, 1, 4);
//! assert_eq!(vec, &[20, 50, 30, 40, 10, 60]);
//! ```
// SPDX-FileCopyrightText: 2023 Markus Mayer
// SPDX-License-Identifier: MIT
Expand Down

0 comments on commit a25a27d

Please sign in to comment.