Trait vulkano::buffer::BufferContents
source · pub unsafe trait BufferContents: Send + Sync + 'static {
fn as_bytes(&self) -> &[u8] ⓘ;
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ;
fn from_bytes(bytes: &[u8]) -> Result<&Self, PodCastError>;
fn from_bytes_mut(bytes: &mut [u8]) -> Result<&mut Self, PodCastError>;
fn size_of_element() -> DeviceSize;
}
Expand description
Trait for types of data that can be put in a buffer. These can be safely transmuted to and from a slice of bytes.
Required Methods§
sourcefn as_bytes(&self) -> &[u8] ⓘ
fn as_bytes(&self) -> &[u8] ⓘ
Converts an immutable reference to Self
to an immutable byte slice.
sourcefn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Converts a mutable reference to Self
to an mutable byte slice.
sourcefn from_bytes(bytes: &[u8]) -> Result<&Self, PodCastError>
fn from_bytes(bytes: &[u8]) -> Result<&Self, PodCastError>
Converts an immutable byte slice into an immutable reference to Self
.
sourcefn from_bytes_mut(bytes: &mut [u8]) -> Result<&mut Self, PodCastError>
fn from_bytes_mut(bytes: &mut [u8]) -> Result<&mut Self, PodCastError>
Converts a mutable byte slice into a mutable reference to Self
.
sourcefn size_of_element() -> DeviceSize
fn size_of_element() -> DeviceSize
Returns the size of an element of the type.