pub enum Value {
Bool(bool),
Int(i32),
Flt(f64),
Str(String),
}
Expand description
Defines fundamental types that can be associated with a device.
Drivers set the type for each device they manage and, for devices
that can be set, only accept values of the correct type.
For devices that return/accept a simple true/false, on/off,
etc., state.
For devices that return/accept an integer value. It is stored
as a signed, 32-bit. This type should primarily be used for
digital inputs/outputs. There is no 64-bit version because
Javascript doesn’t support a 64-bit integer. For integer
values greater than 32 bits, use a Flt
since it can
losslessly handle integers up to 52 bits.
For devices that return/accept floating point numbers or
integers up to 52 bits.
For devices that return/accept text. Since strings can greatly
vary in size, care must be taken when returning this type. A
driver that returns strings rapidly should keep them short.
Longer strings should be returned at a slower rate. If the
system takes too much time serializing string data, it could
throw other portions of DrMem out of “soft real-time”.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String
.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.