add-one icon indicating copy to clipboard operation
add-one copied to clipboard

adds one to a number

trafficstars

add-one

crate documentation

Returns n + 1.

Example

use add_one::add_one;

fn main() {
    let mut bytes = Vec::new();

    match add_one("123".as_bytes(), &mut bytes) {
        Ok(()) => println!("{}", std::str::from_utf8(&bytes).unwrap()),
        Err(e) => {
            eprintln!("Error: {}", e);
        }
    }
}

or

cargo install add-one
add-one 12
13