forked from NotAShelf/beer
beer-protocols/graphics: simplify parse function
Co-authored-by: faukah <fau@faukah.com> Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ibe83c5e6f06ab1c9900f759ac4940ce86a6a6964
This commit is contained in:
parent
b793a8756b
commit
db9b53fdad
1 changed files with 2 additions and 1 deletions
|
|
@ -193,8 +193,9 @@ pub fn parse(control: &[u8]) -> GraphicsCommand {
|
||||||
let Some(eq) = pair.iter().position(|&b| b == b'=') else {
|
let Some(eq) = pair.iter().position(|&b| b == b'=') else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let (key, value) = (pair.get(..eq).unwrap_or(&[]), &pair[eq + 1..]);
|
let (key, value) = pair.split_at(eq);
|
||||||
let [key] = key else { continue };
|
let [key] = key else { continue };
|
||||||
|
let value = &value[1..];
|
||||||
let ch = value.first().copied();
|
let ch = value.first().copied();
|
||||||
match key {
|
match key {
|
||||||
b'a' => {
|
b'a' => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue