scanf

Crates.ioscanf
lib.rsscanf
version1.2.1
sourcesrc
created_at2021-11-27 23:17:28.120332
updated_at2021-12-12 02:09:23.552909
descriptionParse text inputs (inverse of print! and format!)
homepage
repositoryhttps://github.com/jhg/scanf-rs
max_upload_size
id488573
size24,615
Jesus Hernandez (jhg)

documentation

README

Scanf

If you know it from C, same functionality but with memory safety.

let mut number: u32 = 0;
let mut name: String = String::new();
if scanf!("{},{}", number, name).is_ok() {
    println!("Input is: {} and {}", number, name);
}
let input = "5,something";
let mut number: u32 = 0;
let mut name: String = String::new();
if let Err(error) = sscanf!(input, "{},{}", number, name) {
    panic!("Error {} using sscanf!", error);
}

Look more examples in the documentation.

Commit count: 92

cargo fmt