pub struct ProgramBuilder<'b> { /* private fields */ }
Expand description

A builder for Program.

Implementations§

source§

impl<'b> ProgramBuilder<'b>

source

pub fn new() -> ProgramBuilder<'b>

Returns a new, empty, build configuration object.

source

pub fn cmplr_def<'a, S: Into<String>>( &'a mut self, name: S, val: i32 ) -> &'a mut ProgramBuilder<'b>

Adds a build option containing a compiler command line definition. Formatted as -D {name}={val}.

§Example

...cmplr_def("MAX_ITERS", 500)...

source

pub fn cmplr_opt<'a, S: Into<String>>( &'a mut self, co: S ) -> &'a mut ProgramBuilder<'b>

Adds a build option containing a raw compiler command line parameter. Formatted as {} (exact text).

§Example

...cmplr_opt("-g")...

source

pub fn bo<'a>(&'a mut self, bo: BuildOpt) -> &'a mut ProgramBuilder<'b>

Pushes pre-created build option to the list of options.

If either ::il or ::binaries are used and raw source is added, it will be ignored.

source

pub fn src_file<'a, P: Into<PathBuf>>( &'a mut self, file_path: P ) -> &'a mut ProgramBuilder<'b>

Adds the contents of a file to the program.

source

pub fn source_file<'a, P: Into<PathBuf>>( &'a mut self, file_path: P ) -> &'a mut ProgramBuilder<'b>

Opens a file and adds its contents to the program source.

source

pub fn src<'a, S: Into<String>>( &'a mut self, src: S ) -> &'a mut ProgramBuilder<'b>

Adds raw text to the program source.

source

pub fn source<'a, S: Into<String>>( &'a mut self, src: S ) -> &'a mut ProgramBuilder<'b>

Adds raw text to the program source.

source

pub fn binaries<'a>( &'a mut self, bins: &'b [&'b [u8]] ) -> &'a mut ProgramBuilder<'b>

Adds a binary to be loaded.

There must be one binary for each device listed in ::devices.

source

pub fn devices<'a, D: Into<DeviceSpecifier>>( &'a mut self, device_spec: D ) -> &'a mut ProgramBuilder<'b>

Specifies a list of devices to build this program on. The devices must be associated with the context passed to ::build later on.

Devices may be specified in any number of ways including simply passing a device or slice of devices. See the impl From section of DeviceSpecifier for more information.

§Panics

Devices must not have already been specified.

source

pub fn get_device_spec(&self) -> &Option<DeviceSpecifier>

Returns the devices specified to be associated the program.

source

pub fn get_compiler_options(&self) -> OclResult<CString>

Returns a concatenated string of command line options to be passed to the compiler when building this program.

source

pub fn get_src_strings(&self) -> OclResult<Vec<CString>>

Returns the final program source code as a list of strings.

§Order of Inclusion
  1. Macro definitions and code strings specified by a BuildOpt::IncludeDefine or BuildOpt::IncludeRaw via ::bo
  2. Contents of files specified via ::src_file
  3. Contents of strings specified via ::src or a BuildOpt::IncludeRawEof via ::bo
source

pub fn build(&self, context: &Context) -> OclResult<Program>

Returns a newly built Program.

Trait Implementations§

source§

impl<'b> Clone for ProgramBuilder<'b>

source§

fn clone(&self) -> ProgramBuilder<'b>

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<'b> Debug for ProgramBuilder<'b>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'b> Freeze for ProgramBuilder<'b>

§

impl<'b> RefUnwindSafe for ProgramBuilder<'b>

§

impl<'b> Send for ProgramBuilder<'b>

§

impl<'b> Sync for ProgramBuilder<'b>

§

impl<'b> Unpin for ProgramBuilder<'b>

§

impl<'b> UnwindSafe for ProgramBuilder<'b>

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.