drtio_proto: cargo fmt

This commit is contained in:
occheung 2024-08-19 12:03:24 +08:00
parent 740c2f1fc0
commit 1a6782db03
1 changed files with 35 additions and 12 deletions

View File

@ -356,7 +356,7 @@ pub enum Packet {
destination: u8, destination: u8,
}, },
CoreMgmtAck { CoreMgmtAck {
succeeded: bool succeeded: bool,
}, },
} }
@ -647,7 +647,7 @@ impl Packet {
length: length, length: length,
data: data, data: data,
} }
}, }
0xd2 => Packet::CoreMgmtClearLogRequest { 0xd2 => Packet::CoreMgmtClearLogRequest {
destination: reader.read_u8()?, destination: reader.read_u8()?,
}, },
@ -666,7 +666,7 @@ impl Packet {
length: length, length: length,
data: data, data: data,
} }
}, }
0xd5 => Packet::CoreMgmtSetLogLevelRequest { 0xd5 => Packet::CoreMgmtSetLogLevelRequest {
destination: reader.read_u8()?, destination: reader.read_u8()?,
log_level: reader.read_u8()?, log_level: reader.read_u8()?,
@ -685,7 +685,7 @@ impl Packet {
length: length, length: length,
key: key, key: key,
} }
}, }
0xd8 => { 0xd8 => {
let succeeded = reader.read_bool()?; let succeeded = reader.read_bool()?;
let length = reader.read_u16()?; let length = reader.read_u16()?;
@ -698,7 +698,7 @@ impl Packet {
last: last, last: last,
value: value, value: value,
} }
}, }
0xd9 => { 0xd9 => {
let destination = reader.read_u8()?; let destination = reader.read_u8()?;
let length = reader.read_u16()?; let length = reader.read_u16()?;
@ -711,7 +711,7 @@ impl Packet {
last: last, last: last,
data: data, data: data,
} }
}, }
0xda => { 0xda => {
let destination = reader.read_u8()?; let destination = reader.read_u8()?;
let length = reader.read_u16()?; let length = reader.read_u16()?;
@ -722,7 +722,7 @@ impl Packet {
length: length, length: length,
key: key, key: key,
} }
}, }
0xdb => Packet::CoreMgmtConfigEraseRequest { 0xdb => Packet::CoreMgmtConfigEraseRequest {
destination: reader.read_u8()?, destination: reader.read_u8()?,
}, },
@ -1132,7 +1132,12 @@ impl Packet {
writer.write_u8(0xd3)?; writer.write_u8(0xd3)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
} }
Packet::CoreMgmtPullLogReply { destination, last, length, data } => { Packet::CoreMgmtPullLogReply {
destination,
last,
length,
data,
} => {
writer.write_u8(0xd4)?; writer.write_u8(0xd4)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_bool(last)?; writer.write_bool(last)?;
@ -1149,27 +1154,45 @@ impl Packet {
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_u8(log_level)?; writer.write_u8(log_level)?;
} }
Packet::CoreMgmtConfigReadRequest { destination, length, key } => { Packet::CoreMgmtConfigReadRequest {
destination,
length,
key,
} => {
writer.write_u8(0xd7)?; writer.write_u8(0xd7)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_u16(length)?; writer.write_u16(length)?;
writer.write_all(&key[0..length as usize])?; writer.write_all(&key[0..length as usize])?;
} }
Packet::CoreMgmtConfigReadReply { succeeded, length, last, value } => { Packet::CoreMgmtConfigReadReply {
succeeded,
length,
last,
value,
} => {
writer.write_u8(0xd8)?; writer.write_u8(0xd8)?;
writer.write_bool(succeeded)?; writer.write_bool(succeeded)?;
writer.write_u16(length)?; writer.write_u16(length)?;
writer.write_bool(last)?; writer.write_bool(last)?;
writer.write_all(&value[0..length as usize])?; writer.write_all(&value[0..length as usize])?;
} }
Packet::CoreMgmtConfigWriteRequest { destination, length, last, data } => { Packet::CoreMgmtConfigWriteRequest {
destination,
length,
last,
data,
} => {
writer.write_u8(0xd9)?; writer.write_u8(0xd9)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_u16(length)?; writer.write_u16(length)?;
writer.write_bool(last)?; writer.write_bool(last)?;
writer.write_all(&data[0..length as usize])?; writer.write_all(&data[0..length as usize])?;
} }
Packet::CoreMgmtConfigRemoveRequest { destination, length, key } => { Packet::CoreMgmtConfigRemoveRequest {
destination,
length,
key,
} => {
writer.write_u8(0xda)?; writer.write_u8(0xda)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_u16(length)?; writer.write_u16(length)?;