pub enum ValueConversionKind {
Exact(Type),
Truncate(Type),
ExtractUpper(Type),
SignExtend(Type),
ZeroExtend(Type),
RoundNearestEven(Type),
ToBoolean,
Mask(Type),
}Variants§
Exact(Type)
Throw a ValueError if an exact conversion to Type is not possible; e.g. in i32 to
i16, convert 0x00001234 to 0x1234.
Truncate(Type)
Truncate the value to fit into the specified Type; e.g. in i16 to i8, 0x1234 becomes
0x34.
ExtractUpper(Type)
Similar to Truncate, but extracts from the top of the value; e.g. in a i32 to u8,
0x12345678 becomes 0x12.
SignExtend(Type)
Convert to a larger integer type, extending the sign bit; e.g. in i8 to i16, 0xff
becomes 0xffff.
ZeroExtend(Type)
Convert to a larger integer type, extending with zeroes; e.g. in i8 to i16, 0xff
becomes 0x00ff.
RoundNearestEven(Type)
Convert a floating point number by rounding to the nearest possible value with ties to even.
See fdemote, e.g.
ToBoolean
Converts an integer into a boolean, zero integers are converted into a
false, while other integers are converted into true. Booleans are passed through.
Mask(Type)
Converts an integer into either -1 or zero.
Trait Implementations§
source§impl Clone for ValueConversionKind
impl Clone for ValueConversionKind
source§fn clone(&self) -> ValueConversionKind
fn clone(&self) -> ValueConversionKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more