Skip to content

Commit

Permalink
Adapted examples to new API
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianSchmid committed Jan 23, 2023
1 parent 442f4af commit 30086ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ for dlt_message in SliceIterator::new(&buffer) {
match dlt_message {
Ok(dlt_slice) => {
//check if the message is verbose or non verbose (non verbose messages have message ids)
if let Some(message_id) = dlt_slice.message_id() {
if let Some((message_id, non_verbose_payload)) = dlt_slice.message_id_and_payload() {
println!("non verbose message {:x}", message_id);
println!(" with payload {:?}", dlt_slice.non_verbose_payload());
println!(" with payload {:?}", non_verbose_payload);
} else {
println!("verbose message (parsing not yet supported)");
}
Expand Down
4 changes: 2 additions & 2 deletions examples/print_dlt_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> Result<(), ReadError> {

println!("{:?}", msg.storage_header);

if let Some(message_id) = msg.packet.message_id() {
if let Some((message_id, non_verbose_payload)) = msg.packet.message_id_and_payload() {
if let Some(extended_header) = msg.packet.extended_header() {
use core::str::from_utf8;

Expand All @@ -46,7 +46,7 @@ fn main() -> Result<(), ReadError> {
} else {
println!("non verbose message 0x{:x}", message_id);
}
println!(" with payload {:?}", msg.packet.non_verbose_payload());
println!(" with payload {:?}", non_verbose_payload);
} else {
println!("verbose message (parsing not yet supported)");
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
//! match dlt_message {
//! Ok(dlt_slice) => {
//! //check if the message is verbose or non verbose (non verbose messages have message ids)
//! if let Some(message_id) = dlt_slice.message_id() {
//! if let Some((message_id, non_verbose_payload)) = dlt_slice.message_id_and_payload() {
//! println!("non verbose message {:x}", message_id);
//! println!(" with payload {:?}", dlt_slice.non_verbose_payload());
//! println!(" with payload {:?}", non_verbose_payload);
//! } else {
//! println!("verbose message (parsing not yet supported)");
//! }
Expand Down

0 comments on commit 30086ca

Please sign in to comment.