Struct Align
pub struct Align {
raw: Int,
}Expand description
This type is basically a copy of the Align type in the Rust compiler.
See Align.
Fields§
§raw: IntImplementations§
§impl Align
impl Align
pub fn from_bytes(align: impl Into<Int>) -> Option<Align>
pub fn from_bytes(align: impl Into<Int>) -> Option<Align>
Constructs Align with align many bytes.
Returns None if align is not a power of two.
pub const fn from_bytes_const(align: u64) -> Option<Align>
pub const fn from_bytes_const(align: u64) -> Option<Align>
Variation of from_bytes for const contexts.
pub fn from_bits(align: impl Into<Int>) -> Option<Align>
pub fn from_bits(align: impl Into<Int>) -> Option<Align>
Constructs Align with align many bits.
Returns None if align is not divisible by 8, or if align/8 is no power of two.
pub const fn from_bits_const(align: u64) -> Option<Align>
pub const fn from_bits_const(align: u64) -> Option<Align>
Variation of from_bits for const contexts.
pub fn max_for_offset(offset: Size) -> Option<Align>
pub fn max_for_offset(offset: Size) -> Option<Align>
Computes the best alignment possible for the given offset
(the largest power of two that the offset is a multiple of).
For an offset of 0 it returns None.
pub fn restrict_for_offset(self, offset: Size) -> Align
pub fn restrict_for_offset(self, offset: Size) -> Align
Lower the alignment if necessary, such that the given offset is aligned to it (the offset is a multiple of the alignment).
pub fn is_aligned(self, addr: Int) -> bool
pub fn is_aligned(self, addr: Int) -> bool
Check if the given address is sufficiently aligned.
Trait Implementations§
impl Copy for Align
§impl<'de> Deserialize<'de> for Align
impl<'de> Deserialize<'de> for Align
§fn deserialize<D>(
deserializer: D,
) -> Result<Align, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Align, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Align
§impl Ord for Align
impl Ord for Align
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
§impl PartialOrd for Align
impl PartialOrd for Align
§impl Serialize for Align
impl Serialize for Align
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Align
Auto Trait Implementations§
impl !Send for Align
impl !Sync for Align
impl Freeze for Align
impl RefUnwindSafe for Align
impl Unpin for Align
impl UnsafeUnpin for Align
impl UnwindSafe for Align
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more