document_validator 0.2.0

Document validation library
Documentation
mod cnpj;
mod cpf;
mod error;
mod lawsuit_number;
mod prelude;

use std::sync::Arc;

use crate::prelude::*;

pub use cnpj::Cnpj;
pub use cpf::Cpf;
pub use error::Error;
pub use lawsuit_number::LawsuitNumber;

pub trait Document: AsRef<str> + Send + Sync {
    fn new(document: impl Into<Arc<str>>) -> Result<Self>
    where
        Self: Sized;

    fn validate(document: impl Into<Arc<str>>) -> bool
    where
        Self: Sized;

    fn document_name(&self) -> &'static str;
}