Trait coloursum::Line

source ·
pub trait Line: Display + From<String> {
    // Required methods
    fn format_hash(hash: String) -> String;
    fn get_line(&self) -> &FormattableLine;

    // Provided methods
    fn coloursum<I: BufRead, O: Write>(from: I, to: O) -> Result<()> { ... }
    fn to_formatted(&self, formatter: &mut Formatter<'_>) -> Result { ... }
}
Expand description

Used to present a formattable line, which can be derived from a String.

Required Methods§

source

fn format_hash(hash: String) -> String

Formats the given checksum string.

source

fn get_line(&self) -> &FormattableLine

Retrieves the underlying FormattableLine object.

Provided Methods§

source

fn coloursum<I: BufRead, O: Write>(from: I, to: O) -> Result<()>

Takes each line in from, and writes it to to.

If a given line is recognisable as the output of a hashing utility, its hash value will be coloured.

source

fn to_formatted(&self, formatter: &mut Formatter<'_>) -> Result

Writes the processed line to the supplied Formatter.

May be overridden in order to replace the checksum-replacing behaviour if necessary.

Implementors§