| Crates.io | add-one |
| lib.rs | add-one |
| version | 1.0.0 |
| created_at | 2018-08-25 13:58:50.454771+00 |
| updated_at | 2018-10-06 10:00:22.699568+00 |
| description | Adds one to a number |
| homepage | |
| repository | https://github.com/o2sh/add-one |
| max_upload_size | |
| id | 81252 |
| size | 10,061 |
Returns n + 1.
Add this to your Cargo.toml:
[dependencies]
add-one = "1.0"
and this to your crate root:
extern crate add_one;
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
Licensed under
The add-one crate is tested for rustc 1.26 and greater.