pub struct ValueDescriptions<'a> { /* private fields */ }Expand description
Value descriptions for a signal.
Maps numeric signal values to human-readable text descriptions. For example, a gear position signal might map:
- 0 -> “Park”
- 1 -> “Reverse”
- 2 -> “Neutral”
- 3 -> “Drive”
§Examples
use dbc_rs::Dbc;
let dbc_content = r#"VERSION "1.0"
BU_: ECM
BO_ 100 EngineData : 8 ECM
SG_ GearPosition : 0|8@1+ (1,0) [0|5] "" *
VAL_ 100 GearPosition 0 "Park" 1 "Reverse" 2 "Neutral" 3 "Drive" ;
"#;
let dbc = Dbc::parse(dbc_content)?;
let message = dbc.messages().iter().find(|m| m.id() == 100).unwrap();
let signal = message.signals().find("GearPosition").unwrap();
if let Some(value_descriptions) = dbc.value_descriptions_for_signal(message.id(), signal.name()) {
if let Some(description) = value_descriptions.get(0) {
println!("Value 0 means: {}", description);
}
}Implementations§
Source§impl<'a> ValueDescriptions<'a>
impl<'a> ValueDescriptions<'a>
Trait Implementations§
Source§impl<'a> Clone for ValueDescriptions<'a>
impl<'a> Clone for ValueDescriptions<'a>
Source§fn clone(&self) -> ValueDescriptions<'a>
fn clone(&self) -> ValueDescriptions<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§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 ValueDescriptions<'a>
impl<'a> Debug for ValueDescriptions<'a>
Source§impl<'a> Hash for ValueDescriptions<'a>
impl<'a> Hash for ValueDescriptions<'a>
Source§impl<'a> PartialEq for ValueDescriptions<'a>
impl<'a> PartialEq for ValueDescriptions<'a>
impl<'a> Eq for ValueDescriptions<'a>
impl<'a> StructuralPartialEq for ValueDescriptions<'a>
Auto Trait Implementations§
impl<'a> Freeze for ValueDescriptions<'a>
impl<'a> RefUnwindSafe for ValueDescriptions<'a>
impl<'a> Send for ValueDescriptions<'a>
impl<'a> Sync for ValueDescriptions<'a>
impl<'a> Unpin for ValueDescriptions<'a>
impl<'a> UnwindSafe for ValueDescriptions<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more