From ab5b2a1912d2470fce906765be8362e9137e177a Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 6 Sep 2024 12:14:15 +0200 Subject: [PATCH] feat: allow raw input with stdin --- src/format.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/format.rs b/src/format.rs index 60e64c6..c0fdf77 100644 --- a/src/format.rs +++ b/src/format.rs @@ -276,7 +276,7 @@ impl Format { // apperently used nowhere, sometimes 0 is used as a prefix but I // think this makes it more clear that this is decimal Format::Dec => b"0d".to_vec(), - Format::Raw => [].to_vec(), // TODO: find a better way to deal with this + Format::Raw => [0x00].to_vec(), // TODO: find a better way to deal with this // very common Format::Hex => b"0x".to_vec(), // very common @@ -300,6 +300,7 @@ impl Format { let mut buf: Vec = Vec::new(); if options.prefix() { buf.append(&mut self.prefix()); + debug!("prefix the buffer: {buf:X?}"); } match self { Format::Hex => { @@ -335,10 +336,7 @@ impl Format { .to_owned(), ), // Format::Raw => buf.append(&mut split::unsigned_to_vec(num)), - Format::Raw => { - debug!("do the raw thing"); - buf.append(&mut split::unsigned_to_vec(num)) - } + Format::Raw => buf.append(&mut split::unsigned_to_vec(num)), } buf } @@ -460,7 +458,7 @@ where Some(sr) => sr, None => s, }; - todo!("reading raw not implemented") + Ok(join::array_to_unsigned(s.as_bytes())?) } else { let e = "could not determine the format of the value".to_string(); Err(anyhow!(e))