Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions engine/src/rhs_types/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,13 @@ fn write_char(vec: &mut Vec<u8>, c: char) {
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Serialize)]
enum ByteSeparator {
Colon,
Dash,
}

impl Lex<'_> for ByteSeparator {
fn lex(input: &str) -> LexResult<'_, Self> {
let (sep, rest) = take(input, 1)?;
match sep {
":" => Ok((ByteSeparator::Colon, rest)),
"-" => Ok((ByteSeparator::Dash, rest)),
_ => Err((LexErrorKind::ExpectedName("byte separator"), sep)),
}
}
Expand Down Expand Up @@ -343,7 +341,7 @@ mod test {
#[test]
fn test() {
assert_ok!(
BytesExpr::lex("01:2e:f3-77:12;"),
BytesExpr::lex("01:2e:f3:77:12;"),
BytesExpr::from(vec![0x01, 0x2E, 0xF3, 0x77, 0x12]),
";"
);
Expand Down Expand Up @@ -385,7 +383,7 @@ mod test {
);

assert_ok!(
BytesExpr::lex("01:2f-34"),
BytesExpr::lex("01:2f:34"),
BytesExpr::from(vec![0x01, 0x2F, 0x34])
);

Expand Down
Loading