[−][src]Struct heed_types::integer::I16
A 16-bit signed integer
stored in O byte order.
I16 is like the native i16 type with
two major differences: First, it has no alignment requirement (its alignment is 1).
Second, the endianness of its memory layout is given by the type parameter O.
An I16 can be constructed using
the new method, and its contained value can be obtained as a native
i16 using the get method, or updated in place with
the set method. In all cases, if the endianness O is not the same as the
endianness of the current platform, an endianness swap will be performed in
order to uphold the invariants that a) the layout of I16
has endianness O and that, b) the layout of i16 has
the platform's native endianness.
I16 implements Zeroable, and Pod,
making it useful for parsing and serialization.
Implementations
impl<O: ByteOrder> I16<O>[src]
pub fn new(n: i16) -> I16<O>[src]
Constructs a new value, possibly performing an endianness swap
to guarantee that the returned value has endianness O.
pub fn get(self) -> i16[src]
Returns the value as a primitive type, possibly performing an endianness swap to guarantee that the return value has the endianness of the native platform.
pub fn set(&mut self, n: i16)[src]
Updates the value in place as a primitive type, possibly
performing an endianness swap to guarantee that the stored value
has the endianness O.
Trait Implementations
impl<O: ByteOrder> AsMut<[u8; 2]> for I16<O>[src]
impl<O: ByteOrder> AsRef<[u8; 2]> for I16<O>[src]
impl<O: ByteOrder> Binary for I16<O>[src]
impl<O: Clone + ByteOrder> Clone for I16<O>[src]
impl<O: Copy + ByteOrder> Copy for I16<O>[src]
impl<O: ByteOrder> Debug for I16<O>[src]
impl<O: Default + ByteOrder> Default for I16<O>[src]
impl<O: ByteOrder> Display for I16<O>[src]
impl<O: Eq + ByteOrder> Eq for I16<O>[src]
impl<O: ByteOrder> From<[u8; 2]> for I16<O>[src]
impl<O: Hash + ByteOrder> Hash for I16<O>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<O: ByteOrder> LowerHex for I16<O>[src]
impl<O: ByteOrder> Octal for I16<O>[src]
impl<O: ByteOrder> PartialEq<[u8; 2]> for I16<O>[src]
fn eq(&self, other: &[u8; 2]) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<O: PartialEq + ByteOrder> PartialEq<I16<O>> for I16<O>[src]
impl<O: 'static + ByteOrder> Pod for I16<O>[src]
impl<O: ByteOrder> StructuralEq for I16<O>[src]
impl<O: ByteOrder> StructuralPartialEq for I16<O>[src]
impl<O: ByteOrder> UpperHex for I16<O>[src]
impl<O: ByteOrder> Zeroable for I16<O>[src]
Auto Trait Implementations
impl<O> RefUnwindSafe for I16<O> where
O: RefUnwindSafe, [src]
O: RefUnwindSafe,
impl<O> Send for I16<O> where
O: Send, [src]
O: Send,
impl<O> Sync for I16<O> where
O: Sync, [src]
O: Sync,
impl<O> Unpin for I16<O> where
O: Unpin, [src]
O: Unpin,
impl<O> UnwindSafe for I16<O> where
O: UnwindSafe, [src]
O: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,