200 lines
64 KiB
HTML
200 lines
64 KiB
HTML
<!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="Handle to a GPU-accessible buffer."><title>Buffer in wgpu - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="wgpu" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../wgpu/index.html"><img src="https://raw.githubusercontent.com/gfx-rs/wgpu/trunk/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../wgpu/index.html"><img src="https://raw.githubusercontent.com/gfx-rs/wgpu/trunk/logo.png" alt="logo"></a><h2><a href="../wgpu/index.html">wgpu</a><span class="version">23.0.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Buffer</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#mapping-buffers" title="Mapping buffers">Mapping buffers</a></li><li><a href="#example" title="Example">Example</a><ul><li><a href="#mapping-buffers-on-the-web" title="Mapping buffers on the web">Mapping buffers on the web</a></li></ul></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_entire_binding" title="as_entire_binding">as_entire_binding</a></li><li><a href="#method.as_entire_buffer_binding" title="as_entire_buffer_binding">as_entire_buffer_binding</a></li><li><a href="#method.as_hal" title="as_hal">as_hal</a></li><li><a href="#method.destroy" title="destroy">destroy</a></li><li><a href="#method.size" title="size">size</a></li><li><a href="#method.slice" title="slice">slice</a></li><li><a href="#method.unmap" title="unmap">unmap</a></li><li><a href="#method.usage" title="usage">usage</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Buffer" title="Debug">Debug</a></li><li><a href="#impl-Drop-for-Buffer" title="Drop">Drop</a></li><li><a href="#impl-Eq-for-Buffer" title="Eq">Eq</a></li><li><a href="#impl-Hash-for-Buffer" title="Hash">Hash</a></li><li><a href="#impl-Ord-for-Buffer" title="Ord">Ord</a></li><li><a href="#impl-PartialEq-for-Buffer" title="PartialEq">PartialEq</a></li><li><a href="#impl-PartialOrd-for-Buffer" title="PartialOrd">PartialOrd</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Buffer" title="!Freeze">!Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Buffer" title="!RefUnwindSafe">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-Buffer" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Send-for-Buffer" title="Send">Send</a></li><li><a href="#impl-Sync-for-Buffer" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Buffer" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-Comparable%3CK%3E-for-Q" title="Comparable<K>">Comparable<K></a></li><li><a href="#impl-Downcast%3CT%3E-for-T" title="Downcast<T>">Downcast<T></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q-1" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li><li><a href="#impl-Upcast%3CT%3E-for-T" title="Upcast<T>">Upcast<T></a></li><li><a href="#impl-WasmNotSend-for-T" title="WasmNotSend">WasmNotSend</a></li><li><a href="#impl-WasmNotSendSync-for-T" title="WasmNotSendSync">WasmNotSendSync</a></li><li><a href="#impl-WasmNotSync-for-T" title="WasmNotSync">WasmNotSync</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate wgpu</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">wgpu</a></span><h1>Struct <span class="struct">Buffer</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/wgpu/api/buffer.rs.html#174-181">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Buffer { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Handle to a GPU-accessible buffer.</p>
|
||
<p>Created with <a href="struct.Device.html#method.create_buffer" title="method wgpu::Device::create_buffer"><code>Device::create_buffer</code></a> or
|
||
<a href="util/trait.DeviceExt.html#tymethod.create_buffer_init" title="method wgpu::util::DeviceExt::create_buffer_init"><code>DeviceExt::create_buffer_init</code></a>.</p>
|
||
<p>Corresponds to <a href="https://gpuweb.github.io/gpuweb/#buffer-interface">WebGPU <code>GPUBuffer</code></a>.</p>
|
||
<p>A <code>Buffer</code>’s bytes have “interior mutability”: functions like
|
||
<a href="struct.Queue.html#method.write_buffer" title="method wgpu::Queue::write_buffer"><code>Queue::write_buffer</code></a> or <a href="struct.Buffer.html#mapping-buffers" title="struct wgpu::Buffer">mapping</a> a buffer for writing only require a
|
||
<code>&Buffer</code>, not a <code>&mut Buffer</code>, even though they modify its contents. <code>wgpu</code>
|
||
prevents simultaneous reads and writes of buffer contents using run-time
|
||
checks.</p>
|
||
<h2 id="mapping-buffers"><a class="doc-anchor" href="#mapping-buffers">§</a>Mapping buffers</h2>
|
||
<p>If a <code>Buffer</code> is created with the appropriate <a href="../wgpu_types/struct.BufferDescriptor.html#structfield.usage" title="field wgpu_types::BufferDescriptor::usage"><code>usage</code></a>, it can be <em>mapped</em>:
|
||
you can make its contents accessible to the CPU as an ordinary <code>&[u8]</code> or
|
||
<code>&mut [u8]</code> slice of bytes. Buffers created with the
|
||
<a href="../wgpu_types/struct.BufferDescriptor.html#structfield.mapped_at_creation" title="field wgpu_types::BufferDescriptor::mapped_at_creation"><code>mapped_at_creation</code></a> flag set are also mapped initially.</p>
|
||
<p>Depending on the hardware, the buffer could be memory shared between CPU and
|
||
GPU, so that the CPU has direct access to the same bytes the GPU will
|
||
consult; or it may be ordinary CPU memory, whose contents the system must
|
||
copy to/from the GPU as needed. This crate’s API is designed to work the
|
||
same way in either case: at any given time, a buffer is either mapped and
|
||
available to the CPU, or unmapped and ready for use by the GPU, but never
|
||
both. This makes it impossible for either side to observe changes by the
|
||
other immediately, and any necessary transfers can be carried out when the
|
||
buffer transitions from one state to the other.</p>
|
||
<p>There are two ways to map a buffer:</p>
|
||
<ul>
|
||
<li>
|
||
<p>If <a href="../wgpu_types/struct.BufferDescriptor.html#structfield.mapped_at_creation" title="field wgpu_types::BufferDescriptor::mapped_at_creation"><code>BufferDescriptor::mapped_at_creation</code></a> is <code>true</code>, then the entire
|
||
buffer is mapped when it is created. This is the easiest way to initialize
|
||
a new buffer. You can set <code>mapped_at_creation</code> on any kind of buffer,
|
||
regardless of its <a href="../wgpu_types/struct.BufferDescriptor.html#structfield.usage" title="field wgpu_types::BufferDescriptor::usage"><code>usage</code></a> flags.</p>
|
||
</li>
|
||
<li>
|
||
<p>If the buffer’s <a href="../wgpu_types/struct.BufferDescriptor.html#structfield.usage" title="field wgpu_types::BufferDescriptor::usage"><code>usage</code></a> includes the <a href="struct.BufferUsages.html#associatedconstant.MAP_READ" title="associated constant wgpu::BufferUsages::MAP_READ"><code>MAP_READ</code></a> or <a href="struct.BufferUsages.html#associatedconstant.MAP_WRITE" title="associated constant wgpu::BufferUsages::MAP_WRITE"><code>MAP_WRITE</code></a>
|
||
flags, then you can call <code>buffer.slice(range).map_async(mode, callback)</code>
|
||
to map the portion of <code>buffer</code> given by <code>range</code>. This waits for the GPU to
|
||
finish using the buffer, and invokes <code>callback</code> as soon as the buffer is
|
||
safe for the CPU to access.</p>
|
||
</li>
|
||
</ul>
|
||
<p>Once a buffer is mapped:</p>
|
||
<ul>
|
||
<li>
|
||
<p>You can call <code>buffer.slice(range).get_mapped_range()</code> to obtain a
|
||
<a href="struct.BufferView.html" title="struct wgpu::BufferView"><code>BufferView</code></a>, which dereferences to a <code>&[u8]</code> that you can use to read
|
||
the buffer’s contents.</p>
|
||
</li>
|
||
<li>
|
||
<p>Or, you can call <code>buffer.slice(range).get_mapped_range_mut()</code> to obtain a
|
||
<a href="struct.BufferViewMut.html" title="struct wgpu::BufferViewMut"><code>BufferViewMut</code></a>, which dereferences to a <code>&mut [u8]</code> that you can use to
|
||
read and write the buffer’s contents.</p>
|
||
</li>
|
||
</ul>
|
||
<p>The given <code>range</code> must fall within the mapped portion of the buffer. If you
|
||
attempt to access overlapping ranges, even for shared access only, these
|
||
methods panic.</p>
|
||
<p>While a buffer is mapped, you may not submit any commands to the GPU that
|
||
access it. You may record command buffers that use the buffer, but if you
|
||
submit them while the buffer is mapped, submission will panic.</p>
|
||
<p>When you are done using the buffer on the CPU, you must call
|
||
<a href="struct.Buffer.html#method.unmap" title="method wgpu::Buffer::unmap"><code>Buffer::unmap</code></a> to make it available for use by the GPU again. All
|
||
<a href="struct.BufferView.html" title="struct wgpu::BufferView"><code>BufferView</code></a> and <a href="struct.BufferViewMut.html" title="struct wgpu::BufferViewMut"><code>BufferViewMut</code></a> views referring to the buffer must be
|
||
dropped before you unmap it; otherwise, <a href="struct.Buffer.html#method.unmap" title="method wgpu::Buffer::unmap"><code>Buffer::unmap</code></a> will panic.</p>
|
||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||
<p>If <code>buffer</code> was created with <a href="struct.BufferUsages.html#associatedconstant.MAP_WRITE" title="associated constant wgpu::BufferUsages::MAP_WRITE"><code>BufferUsages::MAP_WRITE</code></a>, we could fill it
|
||
with <code>f32</code> values like this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>buffer = std::sync::Arc::new(buffer);
|
||
<span class="kw">let </span>capturable = buffer.clone();
|
||
buffer.slice(..).map_async(wgpu::MapMode::Write, <span class="kw">move </span>|result| {
|
||
<span class="kw">if </span>result.is_ok() {
|
||
<span class="kw">let </span><span class="kw-2">mut </span>view = capturable.slice(..).get_mapped_range_mut();
|
||
<span class="kw">let </span>floats: <span class="kw-2">&mut </span>[f32] = bytemuck::cast_slice_mut(<span class="kw-2">&mut </span>view);
|
||
floats.fill(<span class="number">42.0</span>);
|
||
drop(view);
|
||
capturable.unmap();
|
||
}
|
||
});</code></pre></div>
|
||
<p>This code takes the following steps:</p>
|
||
<ul>
|
||
<li>
|
||
<p>First, it moves <code>buffer</code> into an <a href="https://doc.rust-lang.org/1.84.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc"><code>Arc</code></a>, and makes a clone for capture by
|
||
the callback passed to <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>map_async</code></a>. Since a <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>map_async</code></a> callback may be
|
||
invoked from another thread, interaction between the callback and the
|
||
thread calling <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>map_async</code></a> generally requires some sort of shared heap
|
||
data like this. In real code, the <a href="https://doc.rust-lang.org/1.84.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc"><code>Arc</code></a> would probably own some larger
|
||
structure that itself owns <code>buffer</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Then, it calls <a href="struct.Buffer.html#method.slice" title="method wgpu::Buffer::slice"><code>Buffer::slice</code></a> to make a <a href="struct.BufferSlice.html" title="struct wgpu::BufferSlice"><code>BufferSlice</code></a> referring to
|
||
the buffer’s entire contents.</p>
|
||
</li>
|
||
<li>
|
||
<p>Next, it calls <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>BufferSlice::map_async</code></a> to request that the bytes to
|
||
which the slice refers be made accessible to the CPU (“mapped”). This may
|
||
entail waiting for previously enqueued operations on <code>buffer</code> to finish.
|
||
Although <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>map_async</code></a> itself always returns immediately, it saves the
|
||
callback function to be invoked later.</p>
|
||
</li>
|
||
<li>
|
||
<p>When some later call to <a href="struct.Device.html#method.poll" title="method wgpu::Device::poll"><code>Device::poll</code></a> or <a href="struct.Instance.html#method.poll_all" title="method wgpu::Instance::poll_all"><code>Instance::poll_all</code></a> (not
|
||
shown in this example) determines that the buffer is mapped and ready for
|
||
the CPU to use, it invokes the callback function.</p>
|
||
</li>
|
||
<li>
|
||
<p>The callback function calls <a href="struct.Buffer.html#method.slice" title="method wgpu::Buffer::slice"><code>Buffer::slice</code></a> and then
|
||
<a href="struct.BufferSlice.html#method.get_mapped_range_mut" title="method wgpu::BufferSlice::get_mapped_range_mut"><code>BufferSlice::get_mapped_range_mut</code></a> to obtain a <a href="struct.BufferViewMut.html" title="struct wgpu::BufferViewMut"><code>BufferViewMut</code></a>, which
|
||
dereferences to a <code>&mut [u8]</code> slice referring to the buffer’s bytes.</p>
|
||
</li>
|
||
<li>
|
||
<p>It then uses the <a href="https://crates.io/crates/bytemuck"><code>bytemuck</code></a> crate to turn the <code>&mut [u8]</code> into a <code>&mut [f32]</code>, and calls the slice <a href="https://doc.rust-lang.org/1.84.0/std/primitive.slice.html#method.fill" title="method slice::fill"><code>fill</code></a> method to fill the buffer with a
|
||
useful value.</p>
|
||
</li>
|
||
<li>
|
||
<p>Finally, the callback drops the view and calls <a href="struct.Buffer.html#method.unmap" title="method wgpu::Buffer::unmap"><code>Buffer::unmap</code></a> to unmap
|
||
the buffer. In real code, the callback would also need to do some sort of
|
||
synchronization to let the rest of the program know that it has completed
|
||
its work.</p>
|
||
</li>
|
||
</ul>
|
||
<p>If using <a href="struct.BufferSlice.html#method.map_async" title="method wgpu::BufferSlice::map_async"><code>map_async</code></a> directly is awkward, you may find it more convenient to
|
||
use <a href="struct.Queue.html#method.write_buffer" title="method wgpu::Queue::write_buffer"><code>Queue::write_buffer</code></a> and <a href="util/struct.DownloadBuffer.html#method.read_buffer" title="associated function wgpu::util::DownloadBuffer::read_buffer"><code>util::DownloadBuffer::read_buffer</code></a>.
|
||
However, those each have their own tradeoffs; the asynchronous nature of GPU
|
||
execution makes it hard to avoid friction altogether.</p>
|
||
<h3 id="mapping-buffers-on-the-web"><a class="doc-anchor" href="#mapping-buffers-on-the-web">§</a>Mapping buffers on the web</h3>
|
||
<p>When compiled to WebAssembly and running in a browser content process,
|
||
<code>wgpu</code> implements its API in terms of the browser’s WebGPU implementation.
|
||
In this context, <code>wgpu</code> is further isolated from the GPU:</p>
|
||
<ul>
|
||
<li>
|
||
<p>Depending on the browser’s WebGPU implementation, mapping and unmapping
|
||
buffers probably entails copies between WebAssembly linear memory and the
|
||
graphics driver’s buffers.</p>
|
||
</li>
|
||
<li>
|
||
<p>All modern web browsers isolate web content in its own sandboxed process,
|
||
which can only interact with the GPU via interprocess communication (IPC).
|
||
Although most browsers’ IPC systems use shared memory for large data
|
||
transfers, there will still probably need to be copies into and out of the
|
||
shared memory buffers.</p>
|
||
</li>
|
||
</ul>
|
||
<p>All of these copies contribute to the cost of buffer mapping in this
|
||
configuration.</p>
|
||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#187-277">Source</a><a href="#impl-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_entire_binding" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#189-191">Source</a><h4 class="code-header">pub fn <a href="#method.as_entire_binding" class="fn">as_entire_binding</a>(&self) -> <a class="enum" href="enum.BindingResource.html" title="enum wgpu::BindingResource">BindingResource</a><'_></h4></section></summary><div class="docblock"><p>Return the binding view of the entire buffer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_entire_buffer_binding" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#194-200">Source</a><h4 class="code-header">pub fn <a href="#method.as_entire_buffer_binding" class="fn">as_entire_buffer_binding</a>(&self) -> <a class="struct" href="struct.BufferBinding.html" title="struct wgpu::BufferBinding">BufferBinding</a><'_></h4></section></summary><div class="docblock"><p>Return the binding view of the entire buffer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_hal" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#209-227">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.as_hal" class="fn">as_hal</a><A: <a class="trait" href="../wgpu_core/hal_api/trait.HalApi.html" title="trait wgpu_core::hal_api::HalApi">HalApi</a>, F: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&A::<a class="associatedtype" href="../wgpu_hal/trait.Api.html#associatedtype.Buffer" title="type wgpu_hal::Api::Buffer">Buffer</a>>) -> R, R>(
|
||
&self,
|
||
hal_buffer_callback: F,
|
||
) -> R</h4></section></summary><div class="docblock"><p>Returns the inner hal Buffer using a callback. The hal buffer will be <code>None</code> if the
|
||
backend type argument does not match with this wgpu Buffer</p>
|
||
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
|
||
<ul>
|
||
<li>The raw handle obtained from the hal Buffer must not be manually destroyed</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.slice" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#243-251">Source</a><h4 class="code-header">pub fn <a href="#method.slice" class="fn">slice</a><S: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="type" href="type.BufferAddress.html" title="type wgpu::BufferAddress">BufferAddress</a>>>(&self, bounds: S) -> <a class="struct" href="struct.BufferSlice.html" title="struct wgpu::BufferSlice">BufferSlice</a><'_></h4></section></summary><div class="docblock"><p>Return a slice of a <a href="struct.Buffer.html" title="struct wgpu::Buffer"><code>Buffer</code></a>’s bytes.</p>
|
||
<p>Return a <a href="struct.BufferSlice.html" title="struct wgpu::BufferSlice"><code>BufferSlice</code></a> referring to the portion of <code>self</code>’s contents
|
||
indicated by <code>bounds</code>. Regardless of what sort of data <code>self</code> stores,
|
||
<code>bounds</code> start and end are given in bytes.</p>
|
||
<p>A <a href="struct.BufferSlice.html" title="struct wgpu::BufferSlice"><code>BufferSlice</code></a> can be used to supply vertex and index data, or to map
|
||
buffer contents for access from the CPU. See the <a href="struct.BufferSlice.html" title="struct wgpu::BufferSlice"><code>BufferSlice</code></a>
|
||
documentation for details.</p>
|
||
<p>The <code>range</code> argument can be half or fully unbounded: for example,
|
||
<code>buffer.slice(..)</code> refers to the entire buffer, and <code>buffer.slice(n..)</code>
|
||
refers to the portion starting at the <code>n</code>th byte and extending to the
|
||
end of the buffer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.unmap" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#254-257">Source</a><h4 class="code-header">pub fn <a href="#method.unmap" class="fn">unmap</a>(&self)</h4></section></summary><div class="docblock"><p>Flushes any pending write operations and unmaps the buffer from host memory.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.destroy" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#260-262">Source</a><h4 class="code-header">pub fn <a href="#method.destroy" class="fn">destroy</a>(&self)</h4></section></summary><div class="docblock"><p>Destroy the associated native resources as soon as possible.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.size" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#267-269">Source</a><h4 class="code-header">pub fn <a href="#method.size" class="fn">size</a>(&self) -> <a class="type" href="type.BufferAddress.html" title="type wgpu::BufferAddress">BufferAddress</a></h4></section></summary><div class="docblock"><p>Returns the length of the buffer allocation in bytes.</p>
|
||
<p>This is always equal to the <code>size</code> that was specified when creating the buffer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.usage" class="method"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#274-276">Source</a><h4 class="code-header">pub fn <a href="#method.usage" class="fn">usage</a>(&self) -> <a class="struct" href="struct.BufferUsages.html" title="struct wgpu::BufferUsages">BufferUsages</a></h4></section></summary><div class="docblock"><p>Returns the allowed usages for this <code>Buffer</code>.</p>
|
||
<p>This is always equal to the <code>usage</code> that was specified when creating the buffer.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#173">Source</a><a href="#impl-Debug-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#173">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#669-675">Source</a><a href="#impl-Drop-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#670-674">Source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.84.0/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#impl-Hash-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><H: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&mut H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/hash/mod.rs.html#235-237">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a><H>(data: &[Self], state: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&mut H</a>)<div class="where">where
|
||
H: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#impl-Ord-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.84.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#980-982">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1001-1003">Source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1027-1029">Source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#impl-PartialEq-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#261">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#impl-PartialOrd-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.84.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1335">Source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1353">Source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
|
||
<code><=</code> operator. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1371">Source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code>
|
||
operator. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/cmp.rs.html#1389">Source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
|
||
the <code>>=</code> operator. <a href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><section id="impl-Eq-for-Buffer" class="impl"><a class="src rightside" href="../src/wgpu/api/buffer.rs.html#185">Source</a><a href="#impl-Eq-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Buffer" class="impl"><a href="#impl-Freeze-for-Buffer" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section><section id="impl-RefUnwindSafe-for-Buffer" class="impl"><a href="#impl-RefUnwindSafe-for-Buffer" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section><section id="impl-Send-for-Buffer" class="impl"><a href="#impl-Send-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section><section id="impl-Sync-for-Buffer" class="impl"><a href="#impl-Sync-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section><section id="impl-Unpin-for-Buffer" class="impl"><a href="#impl-Unpin-for-Buffer" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section><section id="impl-UnwindSafe-for-Buffer" class="impl"><a href="#impl-UnwindSafe-for-Buffer" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Buffer.html" title="struct wgpu::Buffer">Buffer</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Comparable%3CK%3E-for-Q" class="impl"><a class="src rightside" href="../src/equivalent/lib.rs.html#104-107">Source</a><a href="#impl-Comparable%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> <a class="trait" href="../equivalent/trait.Comparable.html" title="trait equivalent::Comparable">Comparable</a><K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.compare" class="method trait-impl"><a class="src rightside" href="../src/equivalent/lib.rs.html#110">Source</a><a href="#method.compare" class="anchor">§</a><h4 class="code-header">fn <a href="../equivalent/trait.Comparable.html#tymethod.compare" class="fn">compare</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&K</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return their ordering.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Downcast%3CT%3E-for-T" class="impl"><a class="src rightside" href="../src/khronos_egl/lib.rs.html#148">Source</a><a href="#impl-Downcast%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../khronos_egl/trait.Downcast.html" title="trait khronos_egl::Downcast">Downcast</a><T> for T</h3></section></summary><div class="impl-items"><section id="method.downcast" class="method trait-impl"><a class="src rightside" href="../src/khronos_egl/lib.rs.html#149">Source</a><a href="#method.downcast" class="anchor">§</a><h4 class="code-header">fn <a href="../khronos_egl/trait.Downcast.html#tymethod.downcast" class="fn">downcast</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&T</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q" class="impl"><a class="src rightside" href="../src/hashbrown/lib.rs.html#155-158">Source</a><a href="#impl-Equivalent%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> <a class="trait" href="../hashbrown/trait.Equivalent.html" title="trait hashbrown::Equivalent">Equivalent</a><K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.equivalent" class="method trait-impl"><a class="src rightside" href="../src/hashbrown/lib.rs.html#160">Source</a><a href="#method.equivalent" class="anchor">§</a><h4 class="code-header">fn <a href="../hashbrown/trait.Equivalent.html#tymethod.equivalent" class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this value is equivalent to the given key. <a href="../hashbrown/trait.Equivalent.html#tymethod.equivalent">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q-1" class="impl"><a class="src rightside" href="../src/equivalent/lib.rs.html#82-85">Source</a><a href="#impl-Equivalent%3CK%3E-for-Q-1" class="anchor">§</a><h3 class="code-header">impl<Q, K> <a class="trait" href="../equivalent/trait.Equivalent.html" title="trait equivalent::Equivalent">Equivalent</a><K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.equivalent-1" class="method trait-impl"><a class="src rightside" href="../src/equivalent/lib.rs.html#88">Source</a><a href="#method.equivalent-1" class="anchor">§</a><h4 class="code-header">fn <a href="../equivalent/trait.Equivalent.html#tymethod.equivalent" class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return <code>true</code> if they are equal.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#765">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#748-750">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#758">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#805-807">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#809">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#812">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#790-792">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#794">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#797">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Upcast%3CT%3E-for-T" class="impl"><a class="src rightside" href="../src/khronos_egl/lib.rs.html#158">Source</a><a href="#impl-Upcast%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../khronos_egl/trait.Upcast.html" title="trait khronos_egl::Upcast">Upcast</a><T> for T</h3></section></summary><div class="impl-items"><section id="method.upcast" class="method trait-impl"><a class="src rightside" href="../src/khronos_egl/lib.rs.html#159">Source</a><a href="#method.upcast" class="anchor">§</a><h4 class="code-header">fn <a href="../khronos_egl/trait.Upcast.html#tymethod.upcast" class="fn">upcast</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&T</a>></h4></section></div></details><section id="impl-WasmNotSend-for-T" class="impl"><a class="src rightside" href="../src/wgpu_types/lib.rs.html#7477">Source</a><a href="#impl-WasmNotSend-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.WasmNotSend.html" title="trait wgpu::WasmNotSend">WasmNotSend</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-WasmNotSendSync-for-T" class="impl"><a class="src rightside" href="../src/wgpu_types/lib.rs.html#7461">Source</a><a href="#impl-WasmNotSendSync-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.WasmNotSendSync.html" title="trait wgpu::WasmNotSendSync">WasmNotSendSync</a> for T<div class="where">where
|
||
T: <a class="trait" href="trait.WasmNotSend.html" title="trait wgpu::WasmNotSend">WasmNotSend</a> + <a class="trait" href="trait.WasmNotSync.html" title="trait wgpu::WasmNotSync">WasmNotSync</a>,</div></h3></section><section id="impl-WasmNotSync-for-T" class="impl"><a class="src rightside" href="../src/wgpu_types/lib.rs.html#7510">Source</a><a href="#impl-WasmNotSync-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.WasmNotSync.html" title="trait wgpu::WasmNotSync">WasmNotSync</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section></div></section></div></main></body></html> |