Struct hex_utils::Options [] [src]

pub struct Options {
    pub size: usize,
    pub pack: Vec<usize>,
    pub dot: char,
}

Options how to create xxd output.

Fields

how many bytes per line

how to pack xx bytes next to each other (each value in vec, will put space every that byte)

standard xxd will print '.' for non printable char, here you can change it.

Methods

impl Options
[src]

Create default options

Examples

extern crate hex_utils;

let options = hex_utils::Options::default().unwrap();

assert_eq!(16, options.size);

Get the options out of Option or get the default ones.

Examples

let options = Some(hex_utils::Options { size: 9, pack: vec![3,5], dot: '#' });

let opt = hex_utils::Options::or_default(options);
assert_eq!(9, opt.size);
assert_eq!(vec![3,5], opt.pack);
assert_eq!('#', opt.dot);

let opt = hex_utils::Options::or_default(None);
assert_eq!(16, opt.size);
assert_eq!(vec![2,4,8], opt.pack);
assert_eq!('.', opt.dot);

Format the xxd output based on these options.