Struct x328_proto::Value [−][src]
pub struct Value(_, _);
Value represents an integer that can be sent over the X3.28 protocol.
It is range limited to [-99999, 999999], since the on-wire representation is limited to six ascii characters.
Implementations
impl Value
[src]
impl Value
[src]pub fn new(value: impl TryInto<i32>) -> Result<Self, Error>
[src]
Create a new Value
, checking that the given value
can be represented
in the on-wire format.
Errors
Returns Error::InvalidValue
if value
is out of range.
pub fn try_into_u16(self) -> Option<u16>
[src]
Returns the contained value as u16 if it can be converted without truncation.
Methods from Deref<Target = i32>
pub const MIN: i32
1.43.0[src]
pub const MAX: i32
1.43.0[src]
pub const BITS: u32
1.53.0[src]
pub fn as_ne_bytes(&self) -> &[u8; 4]
[src]
🔬 This is a nightly-only experimental API. (
num_as_ne_bytes
)Return the memory representation of this integer as a byte array in native byte order.
to_ne_bytes
should be preferred over this whenever possible.
Examples
#![feature(num_as_ne_bytes)] let num = 0x12345678i32; let bytes = num.as_ne_bytes(); assert_eq!( bytes, if cfg!(target_endian = "big") { &[0x12, 0x34, 0x56, 0x78] } else { &[0x78, 0x56, 0x34, 0x12] } );
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Value
impl RefUnwindSafe for Value
impl UnwindSafe for Value
impl UnwindSafe for Value