Struct gvariant::aligned_bytes::AlignedOffset
source · [−]pub struct AlignedOffset<A: Alignment>(_, _)
where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>;
Expand description
Represents a usize that is some multiple of Alignment::ALIGNMENT
.
AlignedOffset<A2>
is essentially a usize that is multiple of 2. This is
useful because you can slice a AlignedSlice<A2>
and be statically
guaranteed that the slice will still be aligned.
Use .try_new()
, <usize>.try_into()
or align_offset()
to construct
values of this type.
Implementations
sourceimpl<A: Alignment> AlignedOffset<A>
impl<A: Alignment> AlignedOffset<A>
sourcepub fn try_new(value: usize) -> Result<Self, Misaligned>
pub fn try_new(value: usize) -> Result<Self, Misaligned>
Construct an AlignedOffset
from a usize.
Result will be Err(Misaligned)
if the passed value
is not a multiple
of the alignment of this type. This is provided in addition to the
TryInto
impl because there is less scope for type ambiguity with this
function.
Trait Implementations
sourceimpl<A: Alignment> Add<AlignedOffset<A>> for AlignedOffset<A>
impl<A: Alignment> Add<AlignedOffset<A>> for AlignedOffset<A>
sourceimpl<A: Alignment> BitOr<AlignedOffset<A>> for AlignedOffset<A>
impl<A: Alignment> BitOr<AlignedOffset<A>> for AlignedOffset<A>
sourceimpl BitOr<AlignedOffset<A1>> for AlignedOffset<A2>
impl BitOr<AlignedOffset<A1>> for AlignedOffset<A2>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A1>> for AlignedOffset<A4>
impl BitOr<AlignedOffset<A1>> for AlignedOffset<A4>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A1>> for AlignedOffset<A8>
impl BitOr<AlignedOffset<A1>> for AlignedOffset<A8>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A1>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A2>> for AlignedOffset<A1>
impl BitOr<AlignedOffset<A2>> for AlignedOffset<A1>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A2>> for AlignedOffset<A4>
impl BitOr<AlignedOffset<A2>> for AlignedOffset<A4>
type Output = AlignedOffset<A2>
type Output = AlignedOffset<A2>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A2>
fn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A2>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A2>> for AlignedOffset<A8>
impl BitOr<AlignedOffset<A2>> for AlignedOffset<A8>
type Output = AlignedOffset<A2>
type Output = AlignedOffset<A2>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A2>
fn bitor(self, rhs: AlignedOffset<A2>) -> AlignedOffset<A2>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A4>> for AlignedOffset<A1>
impl BitOr<AlignedOffset<A4>> for AlignedOffset<A1>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A4>> for AlignedOffset<A2>
impl BitOr<AlignedOffset<A4>> for AlignedOffset<A2>
type Output = AlignedOffset<A2>
type Output = AlignedOffset<A2>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A2>
fn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A2>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A4>> for AlignedOffset<A8>
impl BitOr<AlignedOffset<A4>> for AlignedOffset<A8>
type Output = AlignedOffset<A4>
type Output = AlignedOffset<A4>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A4>
fn bitor(self, rhs: AlignedOffset<A4>) -> AlignedOffset<A4>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A8>> for AlignedOffset<A1>
impl BitOr<AlignedOffset<A8>> for AlignedOffset<A1>
type Output = AlignedOffset<A1>
type Output = AlignedOffset<A1>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A1>
fn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A1>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A8>> for AlignedOffset<A2>
impl BitOr<AlignedOffset<A8>> for AlignedOffset<A2>
type Output = AlignedOffset<A2>
type Output = AlignedOffset<A2>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A2>
fn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A2>
Performs the |
operation. Read more
sourceimpl BitOr<AlignedOffset<A8>> for AlignedOffset<A4>
impl BitOr<AlignedOffset<A8>> for AlignedOffset<A4>
type Output = AlignedOffset<A4>
type Output = AlignedOffset<A4>
The resulting type after applying the |
operator.
sourcefn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A4>
fn bitor(self, rhs: AlignedOffset<A8>) -> AlignedOffset<A4>
Performs the |
operation. Read more
sourceimpl<A: Alignment> Borrow<usize> for AlignedOffset<A>
impl<A: Alignment> Borrow<usize> for AlignedOffset<A>
sourceimpl<A: Clone + Alignment> Clone for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Clone + Alignment> Clone for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
sourcefn clone(&self) -> AlignedOffset<A>
fn clone(&self) -> AlignedOffset<A>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<A: Debug + Alignment> Debug for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Debug + Alignment> Debug for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
sourceimpl<A: Alignment> Display for AlignedOffset<A>
impl<A: Alignment> Display for AlignedOffset<A>
sourceimpl<A: Alignment> From<AlignedOffset<A>> for usize
impl<A: Alignment> From<AlignedOffset<A>> for usize
sourcefn from(value: AlignedOffset<A>) -> Self
fn from(value: AlignedOffset<A>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A2>> for AlignedOffset<A1>
impl From<AlignedOffset<A2>> for AlignedOffset<A1>
sourcefn from(v: AlignedOffset<A2>) -> Self
fn from(v: AlignedOffset<A2>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A4>> for AlignedOffset<A1>
impl From<AlignedOffset<A4>> for AlignedOffset<A1>
sourcefn from(v: AlignedOffset<A4>) -> Self
fn from(v: AlignedOffset<A4>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A4>> for AlignedOffset<A2>
impl From<AlignedOffset<A4>> for AlignedOffset<A2>
sourcefn from(v: AlignedOffset<A4>) -> Self
fn from(v: AlignedOffset<A4>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A8>> for AlignedOffset<A1>
impl From<AlignedOffset<A8>> for AlignedOffset<A1>
sourcefn from(v: AlignedOffset<A8>) -> Self
fn from(v: AlignedOffset<A8>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A8>> for AlignedOffset<A2>
impl From<AlignedOffset<A8>> for AlignedOffset<A2>
sourcefn from(v: AlignedOffset<A8>) -> Self
fn from(v: AlignedOffset<A8>) -> Self
Converts to this type from the input type.
sourceimpl From<AlignedOffset<A8>> for AlignedOffset<A4>
impl From<AlignedOffset<A8>> for AlignedOffset<A4>
sourcefn from(v: AlignedOffset<A8>) -> Self
fn from(v: AlignedOffset<A8>) -> Self
Converts to this type from the input type.
sourceimpl<A: Ord + Alignment> Ord for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Ord + Alignment> Ord for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
sourceimpl<A: PartialEq + Alignment> PartialEq<AlignedOffset<A>> for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: PartialEq + Alignment> PartialEq<AlignedOffset<A>> for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
sourcefn eq(&self, other: &AlignedOffset<A>) -> bool
fn eq(&self, other: &AlignedOffset<A>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &AlignedOffset<A>) -> bool
fn ne(&self, other: &AlignedOffset<A>) -> bool
This method tests for !=
.
sourceimpl<A: Alignment> PartialEq<AlignedOffset<A>> for usize
impl<A: Alignment> PartialEq<AlignedOffset<A>> for usize
sourceimpl<A: Alignment> PartialEq<usize> for AlignedOffset<A>
impl<A: Alignment> PartialEq<usize> for AlignedOffset<A>
sourceimpl<A: PartialOrd + Alignment> PartialOrd<AlignedOffset<A>> for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: PartialOrd + Alignment> PartialOrd<AlignedOffset<A>> for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
sourcefn partial_cmp(&self, other: &AlignedOffset<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &AlignedOffset<A>) -> 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<A: Alignment> PartialOrd<AlignedOffset<A>> for usize
impl<A: Alignment> PartialOrd<AlignedOffset<A>> for usize
sourcefn partial_cmp(&self, other: &AlignedOffset<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &AlignedOffset<A>) -> 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<A: Alignment> PartialOrd<usize> for AlignedOffset<A>
impl<A: Alignment> PartialOrd<usize> for AlignedOffset<A>
sourcefn partial_cmp(&self, other: &usize) -> Option<Ordering>
fn partial_cmp(&self, other: &usize) -> 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<A: Alignment> TryFrom<usize> for AlignedOffset<A>
impl<A: Alignment> TryFrom<usize> for AlignedOffset<A>
impl<A: Copy + Alignment> Copy for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Eq + Alignment> Eq for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Alignment> StructuralEq for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
impl<A: Alignment> StructuralPartialEq for AlignedOffset<A> where
Self: BitOr,
<Self as BitOr>::Output: Into<Self>,
Auto Trait Implementations
impl<A> RefUnwindSafe for AlignedOffset<A> where
A: RefUnwindSafe,
impl<A> Send for AlignedOffset<A> where
A: Send,
impl<A> Sync for AlignedOffset<A> where
A: Sync,
impl<A> Unpin for AlignedOffset<A> where
A: Unpin,
impl<A> UnwindSafe for AlignedOffset<A> where
A: 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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more