gnaw

Crates.iognaw
lib.rsgnaw
version0.0.2
sourcesrc
created_at2020-08-26 16:18:24.56411
updated_at2020-09-10 18:22:41.999752
descriptionConveniently chip small pieces off a slice or `str` to use elsewhere.
homepagehttps://github.com/Tamschi/gnaw/tree/v0.0.2
repositoryhttps://github.com/Tamschi/gnaw
max_upload_size
id281015
size27,922
Tamme Schichler (Tamschi)

documentation

https://docs.rs/gnaw/0.0.2

README

gnaw

Lib.rs Crates.io Docs.rs

Rust 1.40.0 Build Status Crates.io - License

GitHub open issues open pull requests crev reviews

With this crate, you can conveniently chip pieces off a slice or str to use elsewhere.

Installation

Please use cargo-edit to always add the latest version of this library:

cargo add gnaw

Example

use gnaw::{Drain as _, Pop as _, Unshift as _};

let mut text = "abcdefg";

assert_eq!(text.unshift(), Some('a'));
assert_eq!(text.pop(), Some('g'));

let mut drain = text.drain();
assert_eq!(drain.next(), Some('b'));
assert_eq!(drain.next(), Some('c'));
assert_eq!(drain.next_back(), Some('f'));
assert_eq!(drain.next_back(), Some('e'));
drop(drain);

//TODO: Why isn't the mutable borrow released here?
//assert_eq!(text, "d");

License

Licensed under either of

at your option.

Contribution

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.

Code of Conduct

Changelog

Versioning

gnaw strictly follows Semantic Versioning 2.0.0 with the following exceptions:

  • The minor version will not reset to 0 on major version changes (except for v1).
    Consider it the global feature level.
  • The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
    Consider it the global patch level.

This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.

Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.

Commit count: 13

cargo fmt