pub struct DecodedSignal<'a> {
pub name: &'a str,
pub value: f64,
pub unit: Option<&'a str>,
pub description: Option<&'a str>,
}Expand description
A decoded signal from a CAN message.
Contains the signal name, its decoded physical value, unit, and optional value description.
Fields§
§name: &'a strThe name of the signal as defined in the DBC file.
value: f64The decoded physical value after applying factor and offset.
unit: Option<&'a str>The unit of the signal (e.g., “rpm”, “°C”), if defined.
description: Option<&'a str>The value description text if defined in the DBC file (e.g., “Park”, “Drive”). This maps the raw signal value to a human-readable description.
Implementations§
Source§impl<'a> DecodedSignal<'a>
impl<'a> DecodedSignal<'a>
Sourcepub fn new(
name: &'a str,
value: f64,
unit: Option<&'a str>,
description: Option<&'a str>,
) -> Self
pub fn new( name: &'a str, value: f64, unit: Option<&'a str>, description: Option<&'a str>, ) -> Self
Creates a new DecodedSignal with the given name, value, unit, and description.
§Arguments
name- The signal namevalue- The decoded physical value (after applying factor and offset)unit- The optional unit of measurement (e.g., “rpm”, “km/h”)description- The optional value description text (e.g., “Park”, “Drive”)
§Examples
use dbc_rs::DecodedSignal;
let signal = DecodedSignal::new("Gear", 3.0, Some(""), Some("Drive"));
assert_eq!(signal.name, "Gear");
assert_eq!(signal.value, 3.0);
assert_eq!(signal.description, Some("Drive"));Trait Implementations§
Source§impl<'a> Clone for DecodedSignal<'a>
impl<'a> Clone for DecodedSignal<'a>
Source§fn clone(&self) -> DecodedSignal<'a>
fn clone(&self) -> DecodedSignal<'a>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for DecodedSignal<'a>
impl<'a> Debug for DecodedSignal<'a>
Source§impl<'a> PartialEq for DecodedSignal<'a>
impl<'a> PartialEq for DecodedSignal<'a>
impl<'a> StructuralPartialEq for DecodedSignal<'a>
Auto Trait Implementations§
impl<'a> Freeze for DecodedSignal<'a>
impl<'a> RefUnwindSafe for DecodedSignal<'a>
impl<'a> Send for DecodedSignal<'a>
impl<'a> Sync for DecodedSignal<'a>
impl<'a> Unpin for DecodedSignal<'a>
impl<'a> UnwindSafe for DecodedSignal<'a>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)