Skip to main content

PodI16

Struct PodI16 

Source
#[repr(transparent)]
pub struct PodI16(pub [u8; 2]);
Expand description

An alignment-1 wrapper around i16 stored as [u8; 2].

Enables safe zero-copy access inside #[repr(C)] account structs.

Tuple Fields§

§0: [u8; 2]

Implementations§

Source§

impl PodI16

Source

pub const fn from_primitive(n: i16) -> PodI16

Source

pub const fn get(&self) -> i16

Returns the contained native value, converting from little-endian bytes.

Source§

impl PodI16

Source

pub const MAX: PodI16

The largest value representable by the underlying integer type.

Source

pub const MIN: PodI16

The smallest value representable by the underlying integer type.

Source

pub const ZERO: PodI16

The zero value.

Source

pub fn is_zero(&self) -> bool

Returns true if the value is zero.

Source

pub fn checked_add(self, rhs: impl Into<PodI16>) -> Option<PodI16>

Checked addition. Returns None on overflow.

Source

pub fn checked_sub(self, rhs: impl Into<PodI16>) -> Option<PodI16>

Checked subtraction. Returns None on underflow.

Source

pub fn checked_mul(self, rhs: impl Into<PodI16>) -> Option<PodI16>

Checked multiplication. Returns None on overflow.

Source

pub fn checked_div(self, rhs: impl Into<PodI16>) -> Option<PodI16>

Checked division. Returns None if rhs is zero.

Source

pub fn saturating_add(self, rhs: impl Into<PodI16>) -> PodI16

Saturating addition. Clamps at the numeric bounds instead of overflowing.

Source

pub fn saturating_sub(self, rhs: impl Into<PodI16>) -> PodI16

Saturating subtraction. Clamps at the numeric bound instead of underflowing.

Source

pub fn saturating_mul(self, rhs: impl Into<PodI16>) -> PodI16

Saturating multiplication. Clamps at the numeric bounds instead of overflowing.

Trait Implementations§

Source§

impl Add<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i16) -> PodI16

Performs the + operation. Read more
Source§

impl Add for PodI16

Source§

type Output = PodI16

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PodI16) -> PodI16

Performs the + operation. Read more
Source§

impl AddAssign<i16> for PodI16

Source§

fn add_assign(&mut self, rhs: i16)

Performs the += operation. Read more
Source§

impl AddAssign for PodI16

Source§

fn add_assign(&mut self, rhs: PodI16)

Performs the += operation. Read more
Source§

impl BitAnd<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: i16) -> PodI16

Performs the & operation. Read more
Source§

impl BitAnd for PodI16

Source§

type Output = PodI16

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: PodI16) -> PodI16

Performs the & operation. Read more
Source§

impl BitAndAssign<i16> for PodI16

Source§

fn bitand_assign(&mut self, rhs: i16)

Performs the &= operation. Read more
Source§

impl BitAndAssign for PodI16

Source§

fn bitand_assign(&mut self, rhs: PodI16)

Performs the &= operation. Read more
Source§

impl BitOr<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: i16) -> PodI16

Performs the | operation. Read more
Source§

impl BitOr for PodI16

Source§

type Output = PodI16

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: PodI16) -> PodI16

Performs the | operation. Read more
Source§

impl BitOrAssign<i16> for PodI16

Source§

fn bitor_assign(&mut self, rhs: i16)

Performs the |= operation. Read more
Source§

impl BitOrAssign for PodI16

Source§

fn bitor_assign(&mut self, rhs: PodI16)

Performs the |= operation. Read more
Source§

impl BitXor<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: i16) -> PodI16

Performs the ^ operation. Read more
Source§

impl BitXor for PodI16

Source§

type Output = PodI16

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: PodI16) -> PodI16

Performs the ^ operation. Read more
Source§

impl BitXorAssign<i16> for PodI16

Source§

fn bitxor_assign(&mut self, rhs: i16)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for PodI16

Source§

fn bitxor_assign(&mut self, rhs: PodI16)

Performs the ^= operation. Read more
Source§

impl Clone for PodI16

Source§

fn clone(&self) -> PodI16

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PodI16

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for PodI16

Source§

fn default() -> PodI16

Returns the “default value” for a type. Read more
Source§

impl Display for PodI16

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Div<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i16) -> PodI16

Performs the / operation. Read more
Source§

impl Div for PodI16

Source§

type Output = PodI16

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PodI16) -> PodI16

Performs the / operation. Read more
Source§

impl DivAssign<i16> for PodI16

Source§

fn div_assign(&mut self, rhs: i16)

Performs the /= operation. Read more
Source§

impl DivAssign for PodI16

Source§

fn div_assign(&mut self, rhs: PodI16)

Performs the /= operation. Read more
Source§

impl From<i16> for PodI16

Source§

fn from(n: i16) -> PodI16

Converts to this type from the input type.
Source§

impl Mul<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i16) -> PodI16

Performs the * operation. Read more
Source§

impl Mul for PodI16

Source§

type Output = PodI16

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PodI16) -> PodI16

Performs the * operation. Read more
Source§

impl MulAssign<i16> for PodI16

Source§

fn mul_assign(&mut self, rhs: i16)

Performs the *= operation. Read more
Source§

impl MulAssign for PodI16

Source§

fn mul_assign(&mut self, rhs: PodI16)

Performs the *= operation. Read more
Source§

impl Neg for PodI16

Source§

type Output = PodI16

The resulting type after applying the - operator.
Source§

fn neg(self) -> PodI16

Performs the unary - operation. Read more
Source§

impl Not for PodI16

Source§

type Output = PodI16

The resulting type after applying the ! operator.
Source§

fn not(self) -> PodI16

Performs the unary ! operation. Read more
Source§

impl Ord for PodI16

Source§

fn cmp(&self, other: &PodI16) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<i16> for PodI16

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for PodI16

Source§

fn eq(&self, other: &PodI16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<i16> for PodI16

Source§

fn partial_cmp(&self, other: &i16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for PodI16

Source§

fn partial_cmp(&self, other: &PodI16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i16) -> PodI16

Performs the % operation. Read more
Source§

impl Rem for PodI16

Source§

type Output = PodI16

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: PodI16) -> PodI16

Performs the % operation. Read more
Source§

impl RemAssign<i16> for PodI16

Source§

fn rem_assign(&mut self, rhs: i16)

Performs the %= operation. Read more
Source§

impl RemAssign for PodI16

Source§

fn rem_assign(&mut self, rhs: PodI16)

Performs the %= operation. Read more
Source§

impl Shl<u32> for PodI16

Source§

type Output = PodI16

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> PodI16

Performs the << operation. Read more
Source§

impl ShlAssign<u32> for PodI16

Source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
Source§

impl Shr<u32> for PodI16

Source§

type Output = PodI16

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> PodI16

Performs the >> operation. Read more
Source§

impl ShrAssign<u32> for PodI16

Source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
Source§

impl Sub<i16> for PodI16

Source§

type Output = PodI16

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i16) -> PodI16

Performs the - operation. Read more
Source§

impl Sub for PodI16

Source§

type Output = PodI16

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PodI16) -> PodI16

Performs the - operation. Read more
Source§

impl SubAssign<i16> for PodI16

Source§

fn sub_assign(&mut self, rhs: i16)

Performs the -= operation. Read more
Source§

impl SubAssign for PodI16

Source§

fn sub_assign(&mut self, rhs: PodI16)

Performs the -= operation. Read more
Source§

impl Zeroable for PodI16

Source§

fn zeroed() -> Self

Source§

impl Copy for PodI16

Source§

impl Eq for PodI16

Source§

impl Pod for PodI16

Source§

impl StructuralPartialEq for PodI16

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,