Skip to content

Commit

Permalink
query_value_table: impl fmt::Display
Browse files Browse the repository at this point in the history
Implements the `Display` trait for `QueryValueTableCommand`.
  • Loading branch information
ebds-rs committed Aug 18, 2023
1 parent 406d23d commit 63afb6d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/query_value_table/command.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
impl_extended_ops, impl_message_ops, impl_omnibus_extended_command,
len::QUERY_VALUE_TABLE_COMMAND, ExtendedCommand, ExtendedCommandOps, MessageOps, MessageType,
len::QUERY_VALUE_TABLE_COMMAND, std::fmt, ExtendedCommand, ExtendedCommandOps, MessageOps,
MessageType, OmnibusCommandOps,
};

/// Query Value Table - Command (Subtype 0x06)
Expand Down Expand Up @@ -42,6 +43,20 @@ impl_message_ops!(QueryValueTableCommand);
impl_omnibus_extended_command!(QueryValueTableCommand);
impl_extended_ops!(QueryValueTableCommand);

impl fmt::Display for QueryValueTableCommand {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{{")?;
write!(f, r#""acknak": {}, "#, self.acknak())?;
write!(f, r#""device_type": {}, "#, self.device_type())?;
write!(f, r#""message_type": {}, "#, self.message_type())?;
write!(f, r#""extended_command": {}, "#, self.extended_command())?;
write!(f, r#""denomination": {}, "#, self.denomination())?;
write!(f, r#""operational_mode": {}, "#, self.operational_mode())?;
write!(f, r#""configuration": {}"#, self.configuration())?;
write!(f, "}}")
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 63afb6d

Please sign in to comment.