Struct luhn::Luhn [] [src]

pub struct Luhn { /* fields omitted */ }

Luhn represents a thing that can generate or validate the Luhn character for a given input.

Methods

impl Luhn
[src]

Create a new Luhn instance from anything that can be coerced to a &str.

Given an input string, generate the Luhn character.

Returns an error if the input string is empty, or contains a character that is not in the input alphabet.

Validates a Luhn check character. This assumes that the final character of the input string is the Luhn character, and it will validate that the remainder of the string is correct.

Validates a Luhn check character. This is the same as the validate method, but allows providing the Luhn check character out-of-band from the input to validate.

Trait Implementations

impl Debug for Luhn
[src]

Formats the value using the given formatter.