Trait narrow::offset::OffsetElement
source · pub trait OffsetElement: FixedSize + AddAssign + Default + TryFrom<usize, Error = TryFromIntError> + TryInto<usize, Error = TryFromIntError> + Sub<Output = Self> + Sealed + 'static {
type Unsigned: TryFrom<usize, Error = TryFromIntError>;
// Required methods
fn checked_add(self, rhs: Self) -> Option<Self>;
fn checked_add_unsigned(self, rhs: Self::Unsigned) -> Option<Self>;
}Expand description
Types representing offset values.
Values with these types can be used to represent offset values.
This trait is sealed to prevent downstream implementations.
Required Associated Types§
sourcetype Unsigned: TryFrom<usize, Error = TryFromIntError>
type Unsigned: TryFrom<usize, Error = TryFromIntError>
The unsigned variant of Self.
Required Methods§
sourcefn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
Checked addition. Computes self + rhs, returning None if overflow occurred.
sourcefn checked_add_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
fn checked_add_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
Checked addition with an unsigned value. Computes self + rhs, returning None if overflow occurred.
Object Safety§
This trait is not object safe.