# 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]

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]

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]

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]

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]

Adds raw text to the program source.

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

Adds raw text to the program source.

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

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]

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

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`

#### `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

### `impl<'b> Debug for ProgramBuilder<'b>`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)