Struct vulkano::memory::DeviceAlignment
source · 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 fn new(alignment: DeviceSize) -> Option<Self>
pub const fn new(alignment: DeviceSize) -> Option<Self>
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: DeviceSize) -> Self
pub const unsafe fn new_unchecked(alignment: DeviceSize) -> Self
Creates a DeviceAlignment
from a DeviceSize
without checking if it’s a power of two.
Safety
alignment
must be a power of two, which also means it must be non-zero.
sourcepub const fn as_devicesize(self) -> DeviceSize
pub const fn as_devicesize(self) -> DeviceSize
Returns the alignment as a DeviceSize
.
sourcepub const fn as_nonzero(self) -> NonZeroDeviceSize
pub const fn as_nonzero(self) -> NonZeroDeviceSize
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 copy 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§impl From<DeviceAlignment> for NonZeroDeviceSize
impl From<DeviceAlignment> for NonZeroDeviceSize
source§fn from(alignment: DeviceAlignment) -> Self
fn from(alignment: DeviceAlignment) -> Self
Converts to this type from the input type.
source§impl From<DeviceAlignment> for DeviceSize
impl From<DeviceAlignment> for DeviceSize
source§fn from(alignment: DeviceAlignment) -> Self
fn from(alignment: DeviceAlignment) -> Self
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§impl PartialEq for DeviceAlignment
impl PartialEq for DeviceAlignment
source§fn eq(&self, other: &DeviceAlignment) -> bool
fn eq(&self, other: &DeviceAlignment) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DeviceAlignment
impl PartialOrd for DeviceAlignment
1.0.0 · source§fn 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 moresource§impl TryFrom<NonZeroU64> for DeviceAlignment
impl TryFrom<NonZeroU64> for DeviceAlignment
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<u64> for DeviceAlignment
impl TryFrom<u64> for DeviceAlignment
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
impl Copy for DeviceAlignment
impl Eq for DeviceAlignment
impl StructuralEq for DeviceAlignment
impl StructuralPartialEq for DeviceAlignment
Auto Trait Implementations§
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