[][src]Trait tension::Buffer

pub trait Buffer<T: Prm>: Sized + Clone {
    type Context;
    unsafe fn new_uninit_in(context: &Self::Context, len: usize) -> Self;
fn new_filled_in(context: &Self::Context, len: usize, value: T) -> Self;
fn len(&self) -> usize;
fn context(&self) -> &Self::Context;
fn load(&self, dst: &mut [T]);
fn store(&mut self, src: &[T]);
fn copy_from(&mut self, src: &Self);
fn copy_to(&self, dst: &mut Self); }

Associated Types

type Context

Context for buffer allocation.

Loading content...

Required methods

unsafe fn new_uninit_in(context: &Self::Context, len: usize) -> Self

Create uninitialzed buffer. This is unsafe method, but it is helpful for pre-allocation of storage for some operations.

fn new_filled_in(context: &Self::Context, len: usize, value: T) -> Self

Create buffer filled with a single value.

fn len(&self) -> usize

Returns the length of the buffer.

fn context(&self) -> &Self::Context

Context of the buffer.

fn load(&self, dst: &mut [T])

Loads data from buffer to slice.

fn store(&mut self, src: &[T])

Stores data from slice to buffer.

fn copy_from(&mut self, src: &Self)

Copies content to self from another buffer.

fn copy_to(&self, dst: &mut Self)

Copies content from self to another buffer.

Loading content...

Implementors

impl<T: Prm + Interop> Buffer<T> for DeviceBuffer<T>[src]

type Context = DeviceContext

impl<T: Prm> Buffer<T> for HostBuffer<T>[src]

type Context = ()

Loading content...