logo
pub struct Dumper<W: Write> { /* private fields */ }
Expand description

Writes annotated hex dumps, like hd(1).

Examples

use sequoia_openpgp::fmt::hex;

let mut dumper = hex::Dumper::new(Vec::new(), "");
dumper.write(&[0x89, 0x01, 0x33], "frame")?;
dumper.write(&[0x04], "version")?;
dumper.write(&[0x00], "type")?;

let buf = dumper.into_inner();
assert_eq!(
    ::std::str::from_utf8(&buf[..])?,
    "00000000  89 01 33                                           frame\n\
     00000003           04                                        version\n\
     00000004              00                                     type\n\
     ");

Implementations

Creates a new dumper.

The dump is written to inner. Every line is indented with indent.

Returns the inner writer.

Writes a chunk of data.

The msg is printed at the end of the first line.

Writes a chunk of data with ASCII-representation.

This produces output similar to hd(1).

Writes a chunk of data.

For each line, the given function is called to compute a label that printed at the end of the first line. The functions first argument is the offset in the current line (0..16), the second the slice of the displayed data.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.