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§
sourcefn format_hash(hash: String) -> String
fn format_hash(hash: String) -> String
Formats the given checksum string.
sourcefn get_line(&self) -> &FormattableLine
fn get_line(&self) -> &FormattableLine
Retrieves the underlying FormattableLine
object.
Provided Methods§
sourcefn coloursum<I: BufRead, O: Write>(from: I, to: O) -> Result<()>
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.
sourcefn to_formatted(&self, formatter: &mut Formatter<'_>) -> Result
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.