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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ValueConversionKind
impl RefUnwindSafe for ValueConversionKind
impl Send for ValueConversionKind
impl Sync for ValueConversionKind
impl Unpin for ValueConversionKind
impl UnwindSafe for ValueConversionKind
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)