Struct ocl::async::BufferSink

source ·
pub struct BufferSink<T: OclPrm> { /* private fields */ }
Expand description

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.

Implementations§

source§

impl<T: OclPrm> BufferSink<T>

source

pub fn new(queue: Queue, len: usize) -> OclResult<BufferSink<T>>

Returns a new BufferSink.

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

source

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

Returns a new BufferSink.

§Safety

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

source

pub fn read(self) -> FutureGuard<Inner<T>, ReadGuard<Inner<T>>>

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

source

pub fn write(self) -> FutureGuard<Inner<T>, WriteGuard<Inner<T>>>

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

source

pub fn flush<'c>(self) -> FlushCmd<'c, T>

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

source

pub fn buffer(&self) -> &Buffer<T>

Returns a reference to the internal buffer.

source

pub fn memory(&self) -> &MemMapCore<T>

Returns a reference to the internal memory mapping.

source

pub fn default_offset(&self) -> usize

Returns a reference to the internal offset.

source

pub fn default_len(&self) -> usize

Returns the length of the memory region.

source

pub unsafe fn as_mut_slice(&mut self) -> &mut [T]

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).

source

pub fn id(&self) -> usize

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

Trait Implementations§

source§

impl<T: Clone + OclPrm> Clone for BufferSink<T>

source§

fn clone(&self) -> BufferSink<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + OclPrm> Debug for BufferSink<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: OclPrm> From<OrderLock<Inner<T>>> for BufferSink<T>

source§

fn from(order_lock: OrderLock<Inner<T>>) -> BufferSink<T>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for BufferSink<T>

§

impl<T> !RefUnwindSafe for BufferSink<T>

§

impl<T> Send for BufferSink<T>

§

impl<T> Sync for BufferSink<T>

§

impl<T> Unpin for BufferSink<T>

§

impl<T> !UnwindSafe for BufferSink<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.