pub struct DeviceAlignment(/* private fields */);Expand description
Vulkan analog of std’s Alignment, stored as a DeviceSize that is guaranteed to be a
valid Vulkan alignment.
Implementations§
Source§impl DeviceAlignment
impl DeviceAlignment
Sourcepub const MIN: DeviceAlignment
pub const MIN: DeviceAlignment
The smallest possible alignment, 1.
Sourcepub const MAX: DeviceAlignment
pub const MAX: DeviceAlignment
The largest possible alignment, 263.
Sourcepub const fn of<T>() -> DeviceAlignment
pub const fn of<T>() -> DeviceAlignment
Returns the alignment for a type.
Sourcepub const fn new(alignment: u64) -> Option<DeviceAlignment>
pub const fn new(alignment: u64) -> Option<DeviceAlignment>
Tries to create a DeviceAlignment from a DeviceSize, returning None if it’s not a
power of two.
Sourcepub const unsafe fn new_unchecked(alignment: u64) -> DeviceAlignment
pub const unsafe fn new_unchecked(alignment: u64) -> DeviceAlignment
Creates a DeviceAlignment from a DeviceSize without checking if it’s a power of two.
§Safety
alignmentmust be a power of two, which also means it must be non-zero.
Sourcepub const fn as_devicesize(self) -> u64
pub const fn as_devicesize(self) -> u64
Returns the alignment as a DeviceSize.
Sourcepub const fn as_nonzero(self) -> NonZero<u64>
pub const fn as_nonzero(self) -> NonZero<u64>
Returns the alignment as a NonZeroDeviceSize.
Trait Implementations§
Source§impl Clone for DeviceAlignment
impl Clone for DeviceAlignment
Source§fn clone(&self) -> DeviceAlignment
fn clone(&self) -> DeviceAlignment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeviceAlignment
impl Debug for DeviceAlignment
Source§impl Default for DeviceAlignment
impl Default for DeviceAlignment
Source§fn default() -> DeviceAlignment
fn default() -> DeviceAlignment
Returns the “default value” for a type. Read more
Source§impl From<DeviceAlignment> for u64
impl From<DeviceAlignment> for u64
Source§fn from(alignment: DeviceAlignment) -> u64
fn from(alignment: DeviceAlignment) -> u64
Converts to this type from the input type.
Source§impl Hash for DeviceAlignment
impl Hash for DeviceAlignment
Source§impl Ord for DeviceAlignment
impl Ord for DeviceAlignment
Source§fn cmp(&self, other: &DeviceAlignment) -> Ordering
fn cmp(&self, other: &DeviceAlignment) -> Ordering
1.21.0 · 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
Source§impl PartialEq for DeviceAlignment
impl PartialEq for DeviceAlignment
Source§impl PartialOrd for DeviceAlignment
impl PartialOrd for DeviceAlignment
Source§impl TryFrom<u64> for DeviceAlignment
impl TryFrom<u64> for DeviceAlignment
Source§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
Source§fn try_from(
alignment: u64,
) -> Result<DeviceAlignment, <DeviceAlignment as TryFrom<u64>>::Error>
fn try_from( alignment: u64, ) -> Result<DeviceAlignment, <DeviceAlignment as TryFrom<u64>>::Error>
Performs the conversion.
impl Copy for DeviceAlignment
impl Eq for DeviceAlignment
impl StructuralPartialEq for DeviceAlignment
Auto Trait Implementations§
impl Freeze for DeviceAlignment
impl RefUnwindSafe for DeviceAlignment
impl Send for DeviceAlignment
impl Sync for DeviceAlignment
impl Unpin for DeviceAlignment
impl UnwindSafe for DeviceAlignment
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