Enum crazyflie_lib::Value [−][src]
pub enum Value {
U8(u8),
U16(u16),
U32(u32),
U64(u64),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
F16(f16),
F32(f32),
F64(f64),
}Expand description
Typed data value
This enum supports all the data types that can be exchanged with the Crazyflie using the log and param subsystems.
A function allows to convert a [u8] to a Value and the Into<Vec
The TryFrom trait is implemented for all matching rust primitive type. There is only direct conversion implemented. For example the following is OK:
let v:u32 = Value::U32(42).try_into().unwrap();However the following will panic:
let v:u32 = Value::U8(42).try_into().unwrap();Variants
U8(u8)u8 value
Tuple Fields of U8
0: u8U16(u16)u16 value
Tuple Fields of U16
0: u16U32(u32)u32 value
Tuple Fields of U32
0: u32U64(u64)u64 value
Tuple Fields of U64
0: u64I8(i8)i8 value
Tuple Fields of I8
0: i8I16(i16)i16 value
Tuple Fields of I16
0: i16I32(i32)i32 value
Tuple Fields of I32
0: i32I64(i64)i64 value
Tuple Fields of I64
0: i64F16(f16)f16 value
Tuple Fields of F16
0: f16F32(f32)f32 value
Tuple Fields of F32
0: f32F64(f64)f64 value
Tuple Fields of F64
0: f64Implementations
Convert a &[u8] slice to a Value. The length of the slice must match
the length of the value type, otherwise an error will be returned.
Make a Value from a f64 and a ValueType
This function allows to construct any type of value from a f64.
The conversion has possibility to be lossy in a couple of cases:
- When making an integer, the value is truncated to the number of bit of the parameter
- Example: Setting
257to au8variable will set it to the value1
- Example: Setting
- Similarly floating point precision will be truncated to the parameter precision. Rounding is undefined.
- Making a floating point outside the range of the parameter is undefined.
- It is not possible to represent accurately a
u64parameter in af64.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Value
impl UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more