pub trait CheckDigitAlgo {
// Required methods
fn validate(&self, protected: &str) -> Result<bool, Error>;
fn generate(&self, unprotected: &str) -> Result<String, Error>;
fn compute(&self, unprotected: &str) -> Result<String, Error>;
}
Expand description
Defines minimum common operations of check digit algorithms.
Required Methods§
Sourcefn validate(&self, protected: &str) -> Result<bool, Error>
fn validate(&self, protected: &str) -> Result<bool, Error>
Returns true if the argument is valid according to the algorithm. The argument must be a protected string that consists of an original string and check digit(s).