validador_crate_rust 1.0.0

Aula de como criar uma Crate
Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 2 items with examples
  • Size
  • Source code size: 5.73 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • torneseumprogramador/validador-crate-rust
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Didox

Como instalar ( Cargo.toml )

[dependencies]
validador_crate_rust = "1.0.0"

Como utilizar

use validador_crate_rust as vd;
use std::io;


fn main() {
    println!("Digite um CPF");

    let mut cpf = String::new();

    match io::stdin().read_line(&mut cpf) {
        Ok(_) => {
            println!("Você digitou: {}", cpf.trim());
        },
        Err(e) => {
            println!("Erro ao ler entrada: {}", e);
        }
    }

    let validado: bool = vd::validador::cpf(cpf.as_str());
    // let validado: bool = vd::validador::cnpj(cnpj.as_str()); ou CNPJ

    if validado {
        println!("O CPF é valido")
    } else {
        println!("O CPF é inválido")
    }
}