Struct ocl::builders::ProgramBuilder
source · pub struct ProgramBuilder<'b> { /* private fields */ }
Expand description
A builder for Program
.
Implementations§
source§impl<'b> ProgramBuilder<'b>
impl<'b> ProgramBuilder<'b>
sourcepub fn new() -> ProgramBuilder<'b>
pub fn new() -> ProgramBuilder<'b>
Returns a new, empty, build configuration object.
sourcepub fn cmplr_def<'a, S: Into<String>>(
&'a mut self,
name: S,
val: i32
) -> &'a mut ProgramBuilder<'b>
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)...
sourcepub fn cmplr_opt<'a, S: Into<String>>(
&'a mut self,
co: S
) -> &'a mut ProgramBuilder<'b>
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")...
sourcepub fn bo<'a>(&'a mut self, bo: BuildOpt) -> &'a mut ProgramBuilder<'b>
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.
sourcepub fn src_file<'a, P: Into<PathBuf>>(
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
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.
sourcepub fn source_file<'a, P: Into<PathBuf>>(
&'a mut self,
file_path: P
) -> &'a mut ProgramBuilder<'b>
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.
sourcepub fn src<'a, S: Into<String>>(
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
pub fn src<'a, S: Into<String>>( &'a mut self, src: S ) -> &'a mut ProgramBuilder<'b>
Adds raw text to the program source.
sourcepub fn source<'a, S: Into<String>>(
&'a mut self,
src: S
) -> &'a mut ProgramBuilder<'b>
pub fn source<'a, S: Into<String>>( &'a mut self, src: S ) -> &'a mut ProgramBuilder<'b>
Adds raw text to the program source.
sourcepub fn binaries<'a>(
&'a mut self,
bins: &'b [&'b [u8]]
) -> &'a mut ProgramBuilder<'b>
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
.
sourcepub fn devices<'a, D: Into<DeviceSpecifier>>(
&'a mut self,
device_spec: D
) -> &'a mut ProgramBuilder<'b>
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.
sourcepub fn get_device_spec(&self) -> &Option<DeviceSpecifier>
pub fn get_device_spec(&self) -> &Option<DeviceSpecifier>
Returns the devices specified to be associated the program.
sourcepub fn get_compiler_options(&self) -> OclResult<CString>
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.
sourcepub fn get_src_strings(&self) -> OclResult<Vec<CString>>
pub fn get_src_strings(&self) -> OclResult<Vec<CString>>
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
Trait Implementations§
source§impl<'b> Clone for ProgramBuilder<'b>
impl<'b> Clone for ProgramBuilder<'b>
source§fn clone(&self) -> ProgramBuilder<'b>
fn clone(&self) -> ProgramBuilder<'b>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more