Struct ArgVal

Source
pub struct ArgVal<'a> { /* private fields */ }
Expand description

A reference to a kernel argument value.

§Example:

let kernel = core::create_kernel(&program, "multiply")?;
core::set_kernel_arg(&kernel, 0, ArgVal::scalar(&10.0f32))?;
core::set_kernel_arg(&kernel, 1, ArgVal::mem(&buffer))?;

Implementations§

Source§

impl<'a> ArgVal<'a>

Source

pub fn mem(mem: &'a Mem) -> ArgVal<'a>

Returns a new ArgVal referring to a Mem object.

Source

pub fn mem_null() -> ArgVal<'a>

Returns a new ArgVal corresponding to a null Mem object.

Source

pub fn sampler(sampler: &'a Sampler) -> ArgVal<'a>

Returns a new ArgVal referring to a Sampler object.

Source

pub fn sampler_null() -> ArgVal<'a>

Returns a new ArgVal referring to a null Sampler object.

Source

pub fn primitive<T>(prm: &'a T) -> ArgVal<'a>
where T: OclPrm,

Returns a new ArgVal referring to a scalar or vector primitive.

Source

pub fn scalar<T>(scalar: &'a T) -> ArgVal<'a>
where T: OclPrm,

Returns a new ArgVal referring to a scalar primitive.

Source

pub fn vector<T>(vector: &'a T) -> ArgVal<'a>
where T: OclPrm,

Returns a new ArgVal referring to a vector primitive.

Source

pub fn local<T>(length: &usize) -> ArgVal<'a>
where T: OclPrm,

Returns a new ArgVal corresponding to a __local argument.

To specify a __local argument size in bytes, use ::raw instead (with value: std::ptr::null()).

Source

pub unsafe fn from_raw( size: size_t, value: *const c_void, is_mem: bool, ) -> ArgVal<'a>

Returns a new ArgVal containing the size in bytes and a raw pointer to the argument value.

§Safety

Caller must ensure that the value pointed to by value lives until the call to ::set_kernel_arg returns and that size accurately reflects the total number of bytes that should be read.

Source

pub fn as_raw(&self) -> (size_t, *const c_void)

Returns the size (in bytes) and raw pointer to the contained kernel argument value.

Source

pub fn is_mem_null(&self) -> bool

Returns true if this ArgVal represents a null Mem or Sampler object.

Trait Implementations§

Source§

impl<'a> Clone for ArgVal<'a>

Source§

fn clone(&self) -> ArgVal<'a>

Returns a duplicate 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<'a> Debug for ArgVal<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ArgVal<'a>

§

impl<'a> RefUnwindSafe for ArgVal<'a>

§

impl<'a> !Send for ArgVal<'a>

§

impl<'a> !Sync for ArgVal<'a>

§

impl<'a> Unpin for ArgVal<'a>

§

impl<'a> UnwindSafe for ArgVal<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.