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
size: usize
how many bytes per line
pack: Vec<usize>
how to pack xx bytes next to each other (each value in vec, will put space every that byte)
dot: char
standard xxd will print '.' for non printable char, here you can change it.
Methods
impl Options
[src]
fn default() -> Option<Options>
Create default options
Examples
extern crate hex_utils; let options = hex_utils::Options::default().unwrap(); assert_eq!(16, options.size);
fn or_default(options: Option<Options>) -> Options
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);
fn formatter(&self) -> Box<Fn((usize, String, Option<String>)) -> String>
Format the xxd output based on these options.