Struct primordial::Offset
source · [−]#[repr(transparent)]pub struct Offset<T, U>(_, _);
Expand description
An offset of a number of items of type T
from a base
Note well that this is NOT stored in memory as the number of bytes, but rather the number of items.
One important additional feature is that offsets can be converted between
underlying types so long as the conversion is lossless for the target CPU
architecture. For example, Offset<u64>
can be converted to
Offset<usize>
on 64-bit systems.
Implementations
sourceimpl<T, U> Offset<T, U>
impl<T, U> Offset<T, U>
sourcepub const fn from_items(items: T) -> Self
pub const fn from_items(items: T) -> Self
Create an offset value from the number of items
Trait Implementations
sourceimpl<T, U> Add<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: Add<T, Output = T>,
impl<T, U> Add<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: Add<T, Output = T>,
sourceimpl<T, U> AddAssign<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: AddAssign<T>,
impl<T, U> AddAssign<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: AddAssign<T>,
sourcefn add_assign(&mut self, rhs: Offset<T, U>)
fn add_assign(&mut self, rhs: Offset<T, U>)
Performs the +=
operation. Read more
sourceimpl<T: AddAssign<T>, U> AddAssign<Offset<T, U>> for Offset<T, U>
impl<T: AddAssign<T>, U> AddAssign<Offset<T, U>> for Offset<T, U>
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl<T: DivAssign<T>, U> DivAssign<Offset<T, U>> for Offset<T, U>
impl<T: DivAssign<T>, U> DivAssign<Offset<T, U>> for Offset<T, U>
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the /=
operation. Read more
sourceimpl<T: MulAssign<T>, U> MulAssign<Offset<T, U>> for Offset<T, U>
impl<T: MulAssign<T>, U> MulAssign<Offset<T, U>> for Offset<T, U>
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *=
operation. Read more
sourceimpl<T: Ord, U> Ord for Offset<T, U>
impl<T: Ord, U> Ord for Offset<T, U>
sourceimpl<T: PartialOrd, U> PartialOrd<Offset<T, U>> for Offset<T, U>
impl<T: PartialOrd, U> PartialOrd<Offset<T, U>> for Offset<T, U>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T: RemAssign<T>, U> RemAssign<Offset<T, U>> for Offset<T, U>
impl<T: RemAssign<T>, U> RemAssign<Offset<T, U>> for Offset<T, U>
sourcefn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the %=
operation. Read more
sourceimpl<T, U> Sub<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: Sub<T, Output = T>,
impl<T, U> Sub<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: Sub<T, Output = T>,
sourceimpl<T, U> SubAssign<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: SubAssign<T>,
impl<T, U> SubAssign<Offset<T, U>> for Address<T, U> where
Offset<usize, ()>: Into<Offset<T, ()>>,
T: Mul<T, Output = T>,
T: SubAssign<T>,
sourcefn sub_assign(&mut self, rhs: Offset<T, U>)
fn sub_assign(&mut self, rhs: Offset<T, U>)
Performs the -=
operation. Read more
sourceimpl<T: SubAssign<T>, U> SubAssign<Offset<T, U>> for Offset<T, U>
impl<T: SubAssign<T>, U> SubAssign<Offset<T, U>> for Offset<T, U>
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
impl<T: Copy, U: Copy> Copy for Offset<T, U>
impl<T: Eq, U> Eq for Offset<T, U>
Auto Trait Implementations
impl<T, U> RefUnwindSafe for Offset<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Offset<T, U> where
T: Send,
U: Send,
impl<T, U> Sync for Offset<T, U> where
T: Sync,
U: Sync,
impl<T, U> Unpin for Offset<T, U> where
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for Offset<T, U> where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more