Struct ocl::builders::ProgramBuilder
[−]
[src]
#[must_use = "builders do nothing unless \'::build\' is called"]pub struct ProgramBuilder<'b> { /* fields omitted */ }
A builder for Program
.
Methods
impl<'b> ProgramBuilder<'b>
[src]
pub fn new() -> ProgramBuilder<'b>
[src]
Returns a new, empty, build configuration object.
pub fn cmplr_def<'a, S: Into<String>>(
&'a mut self,
name: S,
val: i32
) -> &'a mut ProgramBuilder<'b>
[src]
&'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)...
pub fn cmplr_opt<'a, S: Into<String>>(
&'a mut self,
co: S
) -> &'a mut ProgramBuilder<'b>
[src]
&'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")...
pub fn bo<'a>(&'a mut self, bo: BuildOpt) -> &'a mut ProgramBuilder<'b>
[src]
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.
pub fn src_file<'a, P: Into<PathBuf>>(
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
[src]
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
Adds the contents of a file to the program.
pub fn source_file<'a, P: Into<PathBuf>>(
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
[src]
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
Opens a file and adds its contents to the program source.
pub fn src<'a, S: Into<String>>(
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
[src]
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
Adds raw text to the program source.
pub fn source<'a, S: Into<String>>(
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
[src]
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
Adds raw text to the program source.
pub fn binaries<'a>(
&'a mut self,
bins: &'b [&'b [u8]]
) -> &'a mut ProgramBuilder<'b>
[src]
&'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
.
pub fn devices<'a, D: Into<DeviceSpecifier>>(
&'a mut self,
device_spec: D
) -> &'a mut ProgramBuilder<'b>
[src]
&'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.
pub fn get_device_spec(&self) -> &Option<DeviceSpecifier>
[src]
Returns the devices specified to be associated the program.
pub fn get_compiler_options(&self) -> OclResult<CString>
[src]
Returns a concatenated string of command line options to be passed to the compiler when building this program.
pub fn get_src_strings(&self) -> OclResult<Vec<CString>>
[src]
Returns the final program source code as a list of strings.
Order of Inclusion
- Macro definitions and code strings specified by a
BuildOpt::IncludeDefine
orBuildOpt::IncludeRaw
via::bo
- Contents of files specified via
::src_file
- Contents of strings specified via
::src
or aBuildOpt::IncludeRawEof
via::bo
pub fn build(&self, context: &Context) -> OclResult<Program>
[src]
Returns a newly built Program.
Trait Implementations
impl<'b> Clone for ProgramBuilder<'b>
[src]
fn clone(&self) -> ProgramBuilder<'b>
[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