pub struct SignalDef {
pub name: String,
pub start_bit: u64,
pub size: u64,
pub big_endian: bool,
pub signed: bool,
pub factor: f64,
pub offset: f64,
pub unit: String,
pub multiplexing: Multiplexing,
pub value_table: Vec<(i64, String)>,
}Expand description
Where a signal sits in a payload and how to scale it.
Byte order decides what start_bit means, and it is the part most easily got
wrong:
- Little-endian (Intel).
start_bitis the signal’s least significant bit, in a numbering that runs LSB-first within each byte and then to the next byte. The signal grows upwards from there. - Big-endian (Motorola).
start_bitnames the signal’s most significant bit in that same numbering, but the signal grows downwards through the byte and continues at the top of the next one.
Fields§
§name: StringSignal name.
start_bit: u64Bit position, interpreted according to big_endian.
size: u64Width in bits, at most 64.
big_endian: boolWhether the signal is stored most-significant-byte first.
signed: boolWhether the raw value is two’s-complement signed.
factor: f64Multiplier applied to the raw value.
offset: f64Constant added after scaling.
unit: StringPhysical unit, empty when the database gives none.
multiplexing: MultiplexingThe signal’s place in its message’s multiplexing, if any.
value_table: Vec<(i64, String)>Labels for raw values, from a DBC VAL_ table. Empty when there is none.
Keyed by the raw value after sign extension but before scaling, which
is what a VAL_ entry names. Held as a list rather than a map because
these tables run to a handful of entries, where a linear scan beats
hashing and costs nothing to build.
Trait Implementations§
impl StructuralPartialEq for SignalDef
Auto Trait Implementations§
impl Freeze for SignalDef
impl RefUnwindSafe for SignalDef
impl Send for SignalDef
impl Sync for SignalDef
impl Unpin for SignalDef
impl UnsafeUnpin for SignalDef
impl UnwindSafe for SignalDef
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more