9 releases (1 stable)
Uses old Rust 2015
1.0.0 | Oct 6, 2018 |
---|---|
0.2.4 | Oct 6, 2018 |
0.2.3 | Sep 17, 2018 |
0.2.2 | Aug 26, 2018 |
0.1.2 | Aug 25, 2018 |
#62 in #str
9KB
150 lines
add-one
Returns n + 1.
Usage
Add this to your Cargo.toml
:
[dependencies]
add-one = "1.0"
and this to your crate root:
extern crate add_one;
Example
extern crate add_one;
use add_one::add_one;
use std::str;
fn main() {
let mut bytes = Vec::new();
match add_one("123".as_bytes(), &mut bytes) {
Ok(()) => println!("{}", str::from_utf8(&bytes).unwrap()),
Err(e) => {
eprintln!("Error: {}", e);
}
}
}
or
$ cargo run 12
$ 13
Thanks
License
Licensed under
- MIT license (LICENSE.md or http://opensource.org/licenses/MIT)
Compatibility
The add-one
crate is tested for rustc 1.26 and greater.