Struct solstice::buffer::Buffer[][src]

pub struct Buffer { /* fields omitted */ }

A memory map between a CPU and GPU buffer.

This implementation, while safe, only operates on bytes to better mirror GPU buffers. It is best used through a Mesh to provide information on how the data is laid out internally and allow the use of more types and structures.

This buffer is not resizable. All operations are sized in bytes.

Implementations

impl Buffer[src]

pub fn new(
    ctx: &mut Context,
    size: usize,
    buffer_type: BufferType,
    usage: Usage
) -> Result<Self, GraphicsError>
[src]

Constructs an empty buffer of size bytes.

pub fn with_data(
    ctx: &mut Context,
    data: &[u8],
    buffer_type: BufferType,
    usage: Usage
) -> Result<Self, GraphicsError>
[src]

Constructs a buffer of the size and contents of the passed in the Vec.

pub fn handle(&self) -> BufferKey[src]

Returns an identifier that can be used with the graphics context to retrieve the raw GPU buffer handle.

pub fn size(&self) -> usize[src]

The buffer’s capacity/size. Since it’s not resizable these concepts are the same.

pub fn buffer_type(&self) -> BufferType[src]

The buffer’s type.

pub fn usage(&self) -> Usage[src]

The buffer’s usage.

Trait Implementations

impl Clone for Buffer[src]

impl Debug for Buffer[src]

Auto Trait Implementations

impl RefUnwindSafe for Buffer

impl Send for Buffer

impl Sync for Buffer

impl Unpin for Buffer

impl UnwindSafe for Buffer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.