# Struct ocl::async::BufferSink [−] [src]

    pub struct BufferSink<T: OclPrm> { /* fields omitted */ }

Represents mapped memory and allows frames of data to be 'flushed' (written) from host-accessible mapped memory region into its associated device-visible buffer in a repeated fashion.

This represents the fastest possible method for continuously writing frames of data to a device.

## Methods

### `impl<T: OclPrm> BufferSink<T>`
[src]

#### `pub fn new(queue: Queue, len: usize) -> OclResult<BufferSink<T>>`
[src]

Returns a new `BufferSink`.

The current thread will be blocked while the buffer is initialized upon calling this function.

#### `pub unsafe fn from_buffer(
buffer: Buffer<T>,
queue: Option<Queue>,
default_offset: usize,
default_len: usize
) -> OclResult<BufferSink<T>>`
[src]

Returns a new `BufferSink`.

## Safety

`buffer` must not have the same region mapped more than once.

#### `pub fn read(self) -> FutureGuard<Inner<T>, ReadGuard<Inner<T>>>`
[src]

Returns a new `FutureGuard` which will resolve into a a `ReadGuard`.

#### `pub fn write(self) -> FutureGuard<Inner<T>, WriteGuard<Inner<T>>>`
[src]

Returns a new `FutureGuard` which will resolve into a a `WriteGuard`.

#### `pub fn flush<'c>(self) -> FlushCmd<'c, T>`
[src]

Returns a command builder which, once enqueued, will flush data from the mapped memory region to the device.

#### `pub fn buffer(&self) -> &Buffer<T>`
[src]

Returns a reference to the internal buffer.

#### `pub fn memory(&self) -> &MemMapCore<T>`
[src]

Returns a reference to the internal memory mapping.

#### `pub fn default_offset(&self) -> usize`
[src]

Returns a reference to the internal offset.

#### `pub fn default_len(&self) -> usize`
[src]

Returns the length of the memory region.

####
ⓘImportant traits for &'a [ u8 ]

### Important traits for &'a [ u8 ]

`impl<'a> Read for &'a [u8]impl<'a> Write for &'a mut [u8]`
`pub unsafe fn as_mut_slice(&self) -> &mut [T]`
[src]

Returns a mutable slice into the contained memory region.

Used by buffer command builders when preparing future read and write commands.

Do not use unless you are 100% certain that there will be no other reads or writes for the entire access duration (only possible if manually manipulating the lock status).

#### `pub fn id(&self) -> usize`
[src]

Returns a pointer address to the internal memory region, usable as a unique identifier.

## Trait Implementations

### `impl<T: Clone + OclPrm> Clone for BufferSink<T>`
[src]

#### `fn clone(&self) -> BufferSink<T>`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

### `impl<T: Debug + OclPrm> Debug for BufferSink<T>`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl<T: OclPrm> From<OrderLock<Inner<T>>> for BufferSink<T>`
[src]

#### `fn from(order_lock: OrderLock<Inner<T>>) -> BufferSink<T>`
[src]

Performs the conversion.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)