Enum dsdl_parser::CastMode
[−]
[src]
pub enum CastMode { Saturated, Truncated, }
Cast mode defines the rules of conversion from the native value of a certain programming language to the serialized field value.
Cast mode may be left undefined, in which case the default will be used.
Variants
Saturated
This is the default cast mode, which will be used if the attribute definition does not specify the cast mode explicitly.
For integers, it prevents an integer overflow - for example, attempting to write 0x44 to a 4-bit field will result in a bitfield value of 0x0F. For floating point values, it prevents overflow when casting to a lower precision floating point representation - for example, 65536.0 will be converted to a float16 as 65504.0; infinity will be preserved.
Truncated
For integers, it discards the excess most significant bits - for example, attempting to write 0x44 to a 4-bit field will produce 0x04. For floating point values, overflow during downcasting will produce an infinity.
Trait Implementations
impl Display for CastMode
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl Clone for CastMode
[src]
fn clone(&self) -> CastMode
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for CastMode
[src]
impl Debug for CastMode
[src]
impl PartialEq for CastMode
[src]
fn eq(&self, __arg_0: &CastMode) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.