struct.ArgVal.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `ArgVal` struct in crate `ocl`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, ArgVal">
  9. <title>ocl::enums::ArgVal - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
  14. <script src="../../storage.js"></script>
  15. </head>
  16. <body class="rustdoc struct">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Struct ArgVal</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.mem">mem</a><a href="#method.mem_null">mem_null</a><a href="#method.sampler">sampler</a><a href="#method.sampler_null">sampler_null</a><a href="#method.primitive">primitive</a><a href="#method.scalar">scalar</a><a href="#method.vector">vector</a><a href="#method.local">local</a><a href="#method.from_raw">from_raw</a><a href="#method.as_raw">as_raw</a><a href="#method.is_null">is_null</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../index.html'>ocl</a>::<wbr><a href='index.html'>enums</a></p><script>window.sidebarCurrent = {name: 'ArgVal', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>ocl</a>::<wbr><a href='index.html'>enums</a>::<wbr><a class="struct" href=''>ArgVal</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#32-36' title='goto source code'>[src]</a></span></h1>
  50. <pre class='rust struct'>pub struct ArgVal&lt;'a&gt; { /* fields omitted */ }</pre><div class='docblock'><p>A reference to a kernel argument value.</p>
  51. <h3 id="example" class="section-header"><a href="#example">Example:</a></h3>
  52. <div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
  53. <span class="kw">let</span> <span class="ident">kernel</span> <span class="op">=</span> <span class="ident">core</span>::<span class="ident">create_kernel</span>(<span class="kw-2">&amp;</span><span class="ident">program</span>, <span class="string">&quot;multiply&quot;</span>)<span class="question-mark">?</span>;
  54. <span class="ident">core</span>::<span class="ident">set_kernel_arg</span>(<span class="kw-2">&amp;</span><span class="ident">kernel</span>, <span class="number">0</span>, <span class="ident">ArgVal</span>::<span class="ident">scalar</span>(<span class="kw-2">&amp;</span><span class="number">10.0f32</span>))<span class="question-mark">?</span>;
  55. <span class="ident">core</span>::<span class="ident">set_kernel_arg</span>(<span class="kw-2">&amp;</span><span class="ident">kernel</span>, <span class="number">1</span>, <span class="ident">ArgVal</span>::<span class="ident">mem</span>(<span class="kw-2">&amp;</span><span class="ident">buffer</span>))<span class="question-mark">?</span>;</pre>
  56. </div>
  57. <h2 id='methods' class='small-section-header'>
  58. Methods<a href='#methods' class='anchor'></a>
  59. </h2>
  60. <h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#38-142' title='goto source code'>[src]</a></span></h3>
  61. <div class='impl-items'><h4 id='method.mem' class="method"><span id='mem.v' class='invisible'><code>pub fn <a href='#method.mem' class='fnname'>mem</a>(mem: &amp;'a <a class="struct" href="../../ocl_core/types/abs/struct.Mem.html" title="struct ocl_core::types::abs::Mem">Mem</a>) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#40-46' title='goto source code'>[src]</a></span></h4>
  62. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a <code>Mem</code> object.</p>
  63. </div><h4 id='method.mem_null' class="method"><span id='mem_null.v' class='invisible'><code>pub fn <a href='#method.mem_null' class='fnname'>mem_null</a>() -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#49-55' title='goto source code'>[src]</a></span></h4>
  64. <div class='docblock'><p>Returns a new <code>ArgVal</code> corresponding to a null <code>Mem</code> object.</p>
  65. </div><h4 id='method.sampler' class="method"><span id='sampler.v' class='invisible'><code>pub fn <a href='#method.sampler' class='fnname'>sampler</a>(sampler: &amp;'a <a class="struct" href="../../ocl_core/types/abs/struct.Sampler.html" title="struct ocl_core::types::abs::Sampler">Sampler</a>) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  66. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a <code>Sampler</code> object.</p>
  67. </div><h4 id='method.sampler_null' class="method"><span id='sampler_null.v' class='invisible'><code>pub fn <a href='#method.sampler_null' class='fnname'>sampler_null</a>() -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#67-73' title='goto source code'>[src]</a></span></h4>
  68. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a null <code>Sampler</code> object.</p>
  69. </div><h4 id='method.primitive' class="method"><span id='primitive.v' class='invisible'><code>pub fn <a href='#method.primitive' class='fnname'>primitive</a>&lt;T&gt;(prm: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>T) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#80-87' title='goto source code'>[src]</a></span></h4>
  70. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a scalar or vector primitive.</p>
  71. </div><h4 id='method.scalar' class="method"><span id='scalar.v' class='invisible'><code>pub fn <a href='#method.scalar' class='fnname'>scalar</a>&lt;T&gt;(scalar: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>T) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#90-93' title='goto source code'>[src]</a></span></h4>
  72. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a scalar primitive.</p>
  73. </div><h4 id='method.vector' class="method"><span id='vector.v' class='invisible'><code>pub fn <a href='#method.vector' class='fnname'>vector</a>&lt;T&gt;(vector: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>T) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#96-99' title='goto source code'>[src]</a></span></h4>
  74. <div class='docblock'><p>Returns a new <code>ArgVal</code> referring to a vector primitive.</p>
  75. </div><h4 id='method.local' class="method"><span id='local.v' class='invisible'><code>pub fn <a href='#method.local' class='fnname'>local</a>&lt;T&gt;(length: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../ocl/traits/trait.OclPrm.html" title="trait ocl::traits::OclPrm">OclPrm</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#105-112' title='goto source code'>[src]</a></span></h4>
  76. <div class='docblock'><p>Returns a new <code>ArgVal</code> corresponding to a <code>__local</code> argument.</p>
  77. <p>To specify a <code>__local</code> argument size in bytes, use <code>::raw</code> instead
  78. (with <code>value</code>: <code>std::ptr::null()</code>).</p>
  79. </div><h4 id='method.from_raw' class="method"><span id='from_raw.v' class='invisible'><code>pub unsafe fn <a href='#method.from_raw' class='fnname'>from_raw</a>(size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="../../libc/enum.c_void.html" title="enum libc::c_void">c_void</a>) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#122-128' title='goto source code'>[src]</a></span></h4>
  80. <div class='docblock'><p>Returns a new <code>ArgVal</code> containing the size in bytes and a raw pointer
  81. to the argument value.</p>
  82. <h3 id="safety" class="section-header"><a href="#safety">Safety</a></h3>
  83. <p>Caller must ensure that the value pointed to by <code>value</code> lives until
  84. the call to <code>::set_kernel_arg</code> returns and that <code>size</code> accurately
  85. reflects the total number of bytes that should be read.</p>
  86. </div><h4 id='method.as_raw' class="method"><span id='as_raw.v' class='invisible'><code>pub fn <a href='#method.as_raw' class='fnname'>as_raw</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="../../libc/enum.c_void.html" title="enum libc::c_void">c_void</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#132-134' title='goto source code'>[src]</a></span></h4>
  87. <div class='docblock'><p>Returns the size (in bytes) and raw pointer to the contained kernel
  88. argument value.</p>
  89. </div><h4 id='method.is_null' class="method"><span id='is_null.v' class='invisible'><code>pub fn <a href='#method.is_null' class='fnname'>is_null</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#139-141' title='goto source code'>[src]</a></span></h4>
  90. <div class='docblock'><p>Returns <code>true</code> if this <code>ArgVal</code> represents a null <code>Mem</code> or <code>Sampler</code>
  91. object.</p>
  92. </div></div>
  93. <h2 id='implementations' class='small-section-header'>
  94. Trait Implementations<a href='#implementations' class='anchor'></a>
  95. </h2>
  96. <h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#31' title='goto source code'>[src]</a></span></h3>
  97. <div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#31' title='goto source code'>[src]</a></span></h4>
  98. <div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
  99. </div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
  100. <div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
  101. </div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../ocl/enums/struct.ArgVal.html" title="struct ocl::enums::ArgVal">ArgVal</a>&lt;'a&gt;</code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#31' title='goto source code'>[src]</a></span></h3>
  102. <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#31' title='goto source code'>[src]</a></span></h4>
  103. <div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
  104. </div></div></section>
  105. <section id='search' class="content hidden"></section>
  106. <section class="footer"></section>
  107. <aside id="help" class="hidden">
  108. <div>
  109. <h1 class="hidden">Help</h1>
  110. <div class="shortcuts">
  111. <h2>Keyboard Shortcuts</h2>
  112. <dl>
  113. <dt><kbd>?</kbd></dt>
  114. <dd>Show this help dialog</dd>
  115. <dt><kbd>S</kbd></dt>
  116. <dd>Focus the search field</dd>
  117. <dt><kbd>↑</kbd></dt>
  118. <dd>Move up in search results</dd>
  119. <dt><kbd>↓</kbd></dt>
  120. <dd>Move down in search results</dd>
  121. <dt><kbd>↹</kbd></dt>
  122. <dd>Switch tab</dd>
  123. <dt><kbd>&#9166;</kbd></dt>
  124. <dd>Go to active search result</dd>
  125. <dt><kbd>+</kbd></dt>
  126. <dd>Expand all sections</dd>
  127. <dt><kbd>-</kbd></dt>
  128. <dd>Collapse all sections</dd>
  129. </dl>
  130. </div>
  131. <div class="infos">
  132. <h2>Search Tricks</h2>
  133. <p>
  134. Prefix searches with a type followed by a colon (e.g.
  135. <code>fn:</code>) to restrict the search to a given type.
  136. </p>
  137. <p>
  138. Accepted types are: <code>fn</code>, <code>mod</code>,
  139. <code>struct</code>, <code>enum</code>,
  140. <code>trait</code>, <code>type</code>, <code>macro</code>,
  141. and <code>const</code>.
  142. </p>
  143. <p>
  144. Search functions by type signature (e.g.
  145. <code>vec -> usize</code> or <code>* -> vec</code>)
  146. </p>
  147. </div>
  148. </div>
  149. </aside>
  150. <script>
  151. window.rootPath = "../../";
  152. window.currentCrate = "ocl";
  153. </script>
  154. <script src="../../main.js"></script>
  155. <script defer src="../../search-index.js"></script>
  156. </body>
  157. </html>