pub struct Scale(/* private fields */);Expand description
The factor a register map applies to a decoded word.
A meter that reports tenths of a unit is read with a scale of 0.1. The constructor is the check: zero would read every register as nothing and no map means that, and a non-finite factor would put a NaN in a reading. A negative scale is accepted — a device whose export register counts down from zero is a map, not a mistake.
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn new(factor: f64) -> Result<Self, ModbusError>
pub fn new(factor: f64) -> Result<Self, ModbusError>
A finite, non-zero factor.
§Errors
Returns ModbusError::NonFiniteScale for NaN or an infinity and
ModbusError::ZeroScale for zero.
Trait Implementations§
impl Copy for Scale
Source§impl PartialOrd for Scale
impl PartialOrd for Scale
impl StructuralPartialEq for Scale
Auto Trait Implementations§
impl Forget for Scale
impl Freeze for Scale
impl Move for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnsafeUnpin for Scale
impl UnwindSafe for Scale
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