<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `ContextBuilder` struct in crate `ocl`.">
<meta name="keywords" content="rust, rustlang, rust-lang, ContextBuilder">
<title>ocl::builders::ContextBuilder - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a></p><script>window.sidebarCurrent = {name: 'ContextBuilder', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a>::<wbr><a class="struct" href=''>ContextBuilder</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a class='srclink' href='../../src/ocl/standard/context.rs.html#225-228' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'><div class="docblock attributes">#[must_use = "builders do nothing unless \'::build\' is called"]
</div>pub struct ContextBuilder { /* fields omitted */ }</pre><div class='docblock'><p>A builder for <code>Context</code>.</p>
<ul>
<li>TODO: Implement index-searching-round-robin-ing methods (and thier '_exact' counterparts).</li>
</ul>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl/standard/context.rs.html#230-321' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>() -> <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Creates a new <code>ContextBuilder</code></p>
<p>Use <code>Context::builder().build().unwrap()</code> for defaults.</p>
<h2 id="defaults" class="section-header"><a href="#defaults">Defaults</a></h2>
<ul>
<li>
<p>The first avaliable platform</p>
</li>
<li>
<p>All devices associated with the first available platform</p>
</li>
<li>
<p>No notify callback function or user data.</p>
</li>
<li>
<p>TODO:</p>
<ul>
<li>That stuff above (find a valid context, devices, etc. first thing).</li>
<li>Handle context creation callbacks.</li>
</ul>
</li>
</ul>
</div><h4 id='method.build' class="method"><span id='build.v' class='invisible'><code>fn <a href='#method.build' class='fnname'>build</a>(&self) -> <a class="type" href="../../ocl/type.Result.html" title="type ocl::Result">OclResult</a><<a class="struct" href="../../ocl/struct.Context.html" title="struct ocl::Context">Context</a>></code></span></h4>
<div class='docblock'><p>Returns a new <code>Context</code> with the parameters hitherinforthto specified (say what?).</p>
<p>Returns a newly created context with the specified platform and set of device types.</p>
</div><h4 id='method.properties' class="method"><span id='properties.v' class='invisible'><code>fn <a href='#method.properties' class='fnname'>properties</a><'a>(<br> &'a mut self, <br> properties: <a class="struct" href="../../ocl/builders/struct.ContextProperties.html" title="struct ocl::builders::ContextProperties">ContextProperties</a><br>) -> &'a mut <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Specify context properties directly.</p>
<p>Overwrites any previously specified properties.</p>
</div><h4 id='method.property' class="method"><span id='property.v' class='invisible'><code>fn <a href='#method.property' class='fnname'>property</a><'a>(<br> &'a mut self, <br> prop_val: <a class="enum" href="../../ocl/enums/enum.ContextPropertyValue.html" title="enum ocl::enums::ContextPropertyValue">ContextPropertyValue</a><br>) -> &'a mut <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Specify a context property.</p>
<p>Overwrites any property with the same variant (i.e.: if
<code>ContextPropertyValue::Platform</code> was already set, it would be
overwritten if <code>prop_val</code> is also <code>ContextPropertyValue::Platform</code>).</p>
</div><h4 id='method.platform' class="method"><span id='platform.v' class='invisible'><code>fn <a href='#method.platform' class='fnname'>platform</a>(&mut self, platform: <a class="struct" href="../../ocl/struct.Platform.html" title="struct ocl::Platform">Platform</a>) -> &mut <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Specifies a platform.</p>
<p>Overwrites any previously specified platform.</p>
</div><h4 id='method.gl_context' class="method"><span id='gl_context.v' class='invisible'><code>fn <a href='#method.gl_context' class='fnname'>gl_context</a>(&mut self, gl_handle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> &mut <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Specifies an OpenGL context to associate with.</p>
<p>Overwrites any previously specified OpenGL context.</p>
</div><h4 id='method.devices' class="method"><span id='devices.v' class='invisible'><code>fn <a href='#method.devices' class='fnname'>devices</a><D: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="../../ocl/builders/enum.DeviceSpecifier.html" title="enum ocl::builders::DeviceSpecifier">DeviceSpecifier</a>>>(<br> &mut self, <br> device_spec: D<br>) -> &mut <a class="struct" href="../../ocl/builders/struct.ContextBuilder.html" title="struct ocl::builders::ContextBuilder">ContextBuilder</a></code></span></h4>
<div class='docblock'><p>Specifies a list of devices with which to associate the context.</p>
<p>Devices may be specified in any number of ways including simply
passing a device or slice of devices. See the [<code>impl From</code>] section of
<a href="enum.DeviceSpecifier.html"><code>DeviceSpecifier</code></a> for more information.</p>
<h2 id="panics" class="section-header"><a href="#panics">Panics</a></h2>
<p>Devices must not have already been specified.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "ocl";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>