Files
phy/guillotiere/struct.AtlasAllocator.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

166 lines
46 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="A dynamic texture atlas allocator using the guillotine algorithm."><title>AtlasAllocator in guillotiere - 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="guillotiere" 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></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../guillotiere/index.html">guillotiere</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Atlas<wbr>Allocator</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#goals" title="Goals">Goals</a></li><li><a href="#the-data-structure" title="The data structure">The data structure</a><ul><li><a href="#merging-siblings" title="Merging siblings">Merging siblings</a></li><li><a href="#merging-unique-children-with-their-parents" title="Merging unique children with their parents">Merging unique children with their parents</a></li><li><a href="#limitations" title="Limitations">Limitations</a></li></ul></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.allocate" title="allocate">allocate</a></li><li><a href="#method.clear" title="clear">clear</a></li><li><a href="#method.deallocate" title="deallocate">deallocate</a></li><li><a href="#method.for_each_allocated_rectangle" title="for_each_allocated_rectangle">for_each_allocated_rectangle</a></li><li><a href="#method.for_each_free_rectangle" title="for_each_free_rectangle">for_each_free_rectangle</a></li><li><a href="#method.grow" title="grow">grow</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.rearrange" title="rearrange">rearrange</a></li><li><a href="#method.reset" title="reset">reset</a></li><li><a href="#method.resize_and_rearrange" title="resize_and_rearrange">resize_and_rearrange</a></li><li><a href="#method.size" title="size">size</a></li><li><a href="#method.with_options" title="with_options">with_options</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-AtlasAllocator" title="Clone">Clone</a></li><li><a href="#impl-Index%3CAllocId%3E-for-AtlasAllocator" title="Index&#60;AllocId&#62;">Index&#60;AllocId&#62;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-AtlasAllocator" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-AtlasAllocator" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-AtlasAllocator" title="Send">Send</a></li><li><a href="#impl-Sync-for-AtlasAllocator" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-AtlasAllocator" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-AtlasAllocator" title="UnwindSafe">UnwindSafe</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&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate guillotiere</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">guillotiere</a></span><h1>Struct <span class="struct">AtlasAllocator</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/guillotiere/allocator.rs.html#320-347">Source</a> </span></div><pre class="rust item-decl"><code>pub struct AtlasAllocator { <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>A dynamic texture atlas allocator using the guillotine algorithm.</p>
<p>The guillotine algorithm is assisted by a data structure that keeps track of
neighboring rectangles to provide fast deallocation and coalescing.</p>
<h3 id="goals"><a class="doc-anchor" href="#goals">§</a>Goals</h3>
<p>Coalescing free rectangles, in the context of dynamic atlas allocation can be
prohibitively expensive under real-time constraints if the algorithm needs to
visit a large amount of free rectangles to find merge candidates.</p>
<p>This implementation proposes a compromise with fast (constant time) search
for merge candidates at the expense of some (constant time) bookkeeping overhead
when allocating and removing rectangles and imperfect defragmentation (see the
“Limitations” section below.</p>
<p>The subdivision scheme uses the worst fit variant of the guillotine algorithm
for its simplicity and CPU efficiency.</p>
<h3 id="the-data-structure"><a class="doc-anchor" href="#the-data-structure">§</a>The data structure</h3>
<p>We maintain a tree with allocated and free rectangles as leaf nodes and
containers as non-leaf nodes.</p>
<p>The direct children of a Containerss form an ordered horizontal or vertical
sequence of rectangles that cover exactly their parent containers area.</p>
<p>For example, a subdivision such as this one:</p>
<div class="example-wrap"><pre class="language-ascii"><code>+-----------+----------+---+---+--+---------+---+
| | | C | D |E | F | G |
| | +---+---+--+---------+---+
| A | B | |
| | | H |
| | | |
+------+----+----------+-+----------------------+
| | J | |
| I +-----------------+ L |
| | K | |
+------+-----------------+----------------------+</code></pre></div>
<p>Would have a tree of the form:</p>
<div class="example-wrap"><pre class="language-ascii"><code>
Tree | Layout
---------------------+------------
|
# |
| |
+----+----+. . .|. vertical
| | |
# # |
| | |
+-+-+ . . +-+-+. .|. horizontal
| | | | | | |
A B # I # L |
| | |
+-+-+ . +-+-+. .|. vertical
| | | | |
# H J K |
| |
+-+-+-+-+. . . . . .|. horizontal
| | | | | |
C D E F G |</code></pre></div>
<p>Where container nodes are represented with “#”.</p>
<p>Note that if a horizontal container is the direct child of another
horizontal container, we can merge the two into a single horizontal
sequence.
We use this property to always keep the tree in its simplest form.
In practice this means that the orientation of a container is always
the opposite of the orientation of its parent, if any.</p>
<p>The goal of this data structure is to quickly find neighboring free
rectangles that can be coalesced into fewer rectangles.
This structure guarantees that two consecutive children of the same
container, if both rectangles are free, can be coalesced into a single
one.</p>
<p>An important thing to note about this tree structure is that we only
use it to visit neighbor and parent nodes. As a result we dont care
about whether the tree is balanced, although flat sequences of children
tend to offer more opportunity for coalescing than deeply nested structures
Either way, the cost of finding potential merges is the same because
each node stores the indices of their siblings, and we never have to
traverse any global list of free rectangle nodes.</p>
<h4 id="merging-siblings"><a class="doc-anchor" href="#merging-siblings">§</a>Merging siblings</h4>
<p>As soon as two consecutive sibling nodes are marked as “free”, they are coalesced
into a single node.</p>
<p>In the example below, we just deallocated the rectangle <code>B</code>, which is a sibling of
<code>A</code> which is free and <code>C</code> which is still allocated. <code>A</code> and <code>B</code> are merged and this
change is reflected on the tree as shown below:</p>
<div class="example-wrap"><pre class="language-ascii"><code>+---+---+---+ # +-------+---+ #
| | |///| | | |///| |
| A | B |/C/| +---+---+ | AB |/C/| +---+---+
| | |///| | | | |///| | |
+---+---+---+ # D +-------+---+ # D
| D | | -&gt; | D | |
| | +-+-+ | | +-+-+
| | | | | | | | |
+-----------+ A B C +-----------+ AB C</code></pre></div><h4 id="merging-unique-children-with-their-parents"><a class="doc-anchor" href="#merging-unique-children-with-their-parents">§</a>Merging unique children with their parents</h4>
<p>In the previous example <code>C</code> was an allocated slot. Lets now deallocate it:</p>
<div class="example-wrap"><pre class="language-ascii"><code>+-------+---+ # +-----------+ # #
| | | | | | | |
| AB | C | +---+---+ | ABC | +---+---+ +---+---+
| | | | | | | | | | |
+-------+---+ # D +-----------+ # D ABC D
| D | | -&gt; | D | | -&gt;
| | +-+-+ | | +
| | | | | | |
+-----------+ AB C +-----------+ ABC</code></pre></div>
<p>Deallocating <code>C</code> allowed it to merge with the free rectangle <code>AB</code>, making the
resulting node <code>ABC</code> the only child of its parent container. As a result the
node <code>ABC</code> was lifted up the tree to replace its parent.</p>
<p>In this example, assuming <code>D</code> to also be a free rectangle, <code>ABC</code> and <code>D</code> would
be immediately merged and the resulting node <code>ABCD</code>, also being only child of
its parent container, would replace its parent, turning the tree into a single
node <code>ABCD</code>.</p>
<h4 id="limitations"><a class="doc-anchor" href="#limitations">§</a>Limitations</h4>
<p>This strategy can miss some opportunities for coalescing free rectangles
when the two sibling containers are split exactly the same way.</p>
<p>For example:</p>
<div class="example-wrap"><pre class="language-ascii"><code>+---------+------+
| A | B |
| | |
+---------+------+
| C | D |
| | |
+---------+------+</code></pre></div>
<p>Could be the result of either a vertical followed with two horizontal splits,
or an horizontal then two vertical splits.</p>
<div class="example-wrap"><pre class="language-ascii"><code> Tree | Layout Tree | Layout
-----------------+------------ -----------------+------------
# | # |
| | | |
+---+---+ . .|. Vertical +---+---+ . .|. Horizontal
| | | | | |
# # | or # # |
| | | | | |
+-+-+ . +-+-+ .|. Horizontal +-+-+ . +-+-+ .|. Vertical
| | | | | | | | | |
A B C D | A C B D |</code></pre></div>
<p>In the former case A cant be merged with C nor B with D because they are not siblings.</p>
<p>For a lot of workloads it is rather rare for two consecutive sibling containers to be
subdivided exactly the same way. In this situation losing the ability to merge rectangles
that arent under the same container is good compromise between the CPU cost of coalescing
and the fragmentation of the atlas.</p>
<p>This algorithm is, however, not the best solution for very “structured” grid-like
subdivision patterns where the ability to merge across containers would have provided
frequent defragmentation opportunities.</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-AtlasAllocator" class="impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#395-1166">Source</a><a href="#impl-AtlasAllocator" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#397-399">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Create an atlas allocator.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_options" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#402-435">Source</a><h4 class="code-header">pub fn <a href="#method.with_options" class="fn">with_options</a>(size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>, options: &amp;<a class="struct" href="struct.AllocatorOptions.html" title="struct guillotiere::AllocatorOptions">AllocatorOptions</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Create an atlas allocator with the provided options.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.size" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#438-440">Source</a><h4 class="code-header">pub fn <a href="#method.size" class="fn">size</a>(&amp;self) -&gt; <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a></h4></section></summary><div class="docblock"><p>The total size of the atlas.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allocate" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#443-622">Source</a><h4 class="code-header">pub fn <a href="#method.allocate" class="fn">allocate</a>(&amp;mut self, requested_size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Allocation.html" title="struct guillotiere::Allocation">Allocation</a>&gt;</h4></section></summary><div class="docblock"><p>Allocate a rectangle in the atlas.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.deallocate" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#625-676">Source</a><h4 class="code-header">pub fn <a href="#method.deallocate" class="fn">deallocate</a>(&amp;mut self, node_id: <a class="struct" href="struct.AllocId.html" title="struct guillotiere::AllocId">AllocId</a>)</h4></section></summary><div class="docblock"><p>Deallocate a rectangle in the atlas.</p>
</div></details><section id="method.is_empty" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#678-682">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#685-712">Source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Drop all rectangles, clearing the atlas to its initial state.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reset" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#715-722">Source</a><h4 class="code-header">pub fn <a href="#method.reset" class="fn">reset</a>(&amp;mut self, size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>, options: &amp;<a class="struct" href="struct.AllocatorOptions.html" title="struct guillotiere::AllocatorOptions">AllocatorOptions</a>)</h4></section></summary><div class="docblock"><p>Clear the allocator and reset its size and options.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.rearrange" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#729-732">Source</a><h4 class="code-header">pub fn <a href="#method.rearrange" class="fn">rearrange</a>(&amp;mut self) -&gt; <a class="struct" href="struct.ChangeList.html" title="struct guillotiere::ChangeList">ChangeList</a></h4></section></summary><div class="docblock"><p>Recompute the allocations in the atlas and returns a list of the changes.</p>
<p>Previous ids and rectangles are not valid anymore after this operation as each id/rectangle
pair is assigned to new values which are communicated in the returned change list.
Rearranging the atlas can help reduce fragmentation.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.resize_and_rearrange" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#735-767">Source</a><h4 class="code-header">pub fn <a href="#method.resize_and_rearrange" class="fn">resize_and_rearrange</a>(&amp;mut self, new_size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>) -&gt; <a class="struct" href="struct.ChangeList.html" title="struct guillotiere::ChangeList">ChangeList</a></h4></section></summary><div class="docblock"><p>Identical to <code>AtlasAllocator::rearrange</code>, also allowing to change the size of the atlas.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.grow" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#772-897">Source</a><h4 class="code-header">pub fn <a href="#method.grow" class="fn">grow</a>(&amp;mut self, new_size: <a class="type" href="type.Size.html" title="type guillotiere::Size">Size</a>)</h4></section></summary><div class="docblock"><p>Resize the atlas without changing the allocations.</p>
<p>This method is not allowed to shrink the width or height of the atlas.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.for_each_free_rectangle" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#900-909">Source</a><h4 class="code-header">pub fn <a href="#method.for_each_free_rectangle" class="fn">for_each_free_rectangle</a>&lt;F&gt;(&amp;self, callback: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;<a class="type" href="type.Rectangle.html" title="type guillotiere::Rectangle">Rectangle</a>),</div></h4></section></summary><div class="docblock"><p>Invoke a callback for each free rectangle in the atlas.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.for_each_allocated_rectangle" class="method"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#912-925">Source</a><h4 class="code-header">pub fn <a href="#method.for_each_allocated_rectangle" class="fn">for_each_allocated_rectangle</a>&lt;F&gt;(&amp;self, callback: F)<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.AllocId.html" title="struct guillotiere::AllocId">AllocId</a>, &amp;<a class="type" href="type.Rectangle.html" title="type guillotiere::Rectangle">Rectangle</a>),</div></h4></section></summary><div class="docblock"><p>Invoke a callback for each allocated rectangle in the atlas.</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-Clone-for-AtlasAllocator" class="impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#319">Source</a><a href="#impl-Clone-for-AtlasAllocator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#319">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" 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/clone.rs.html#174">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CAllocId%3E-for-AtlasAllocator" class="impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#1168-1175">Source</a><a href="#impl-Index%3CAllocId%3E-for-AtlasAllocator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="struct.AllocId.html" title="struct guillotiere::AllocId">AllocId</a>&gt; for <a class="struct" href="struct.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#1169">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="../euclid/box2d/struct.Box2D.html" title="struct euclid::box2d::Box2D">Box2D</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.i32.html">i32</a>, <a class="struct" href="../euclid/struct.UnknownUnit.html" title="struct euclid::UnknownUnit">UnknownUnit</a>&gt;</h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method trait-impl"><a class="src rightside" href="../src/guillotiere/allocator.rs.html#1170-1174">Source</a><a href="#method.index" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&amp;self, index: <a class="struct" href="struct.AllocId.html" title="struct guillotiere::AllocId">AllocId</a>) -&gt; &amp;<a class="type" href="type.Rectangle.html" title="type guillotiere::Rectangle">Rectangle</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.84.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details></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-AtlasAllocator" class="impl"><a href="#impl-Freeze-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section><section id="impl-RefUnwindSafe-for-AtlasAllocator" class="impl"><a href="#impl-RefUnwindSafe-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section><section id="impl-Send-for-AtlasAllocator" class="impl"><a href="#impl-Send-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section><section id="impl-Sync-for-AtlasAllocator" class="impl"><a href="#impl-Sync-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section><section id="impl-Unpin-for-AtlasAllocator" class="impl"><a href="#impl-Unpin-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</a></h3></section><section id="impl-UnwindSafe-for-AtlasAllocator" class="impl"><a href="#impl-UnwindSafe-for-AtlasAllocator" 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.AtlasAllocator.html" title="struct guillotiere::AtlasAllocator">AtlasAllocator</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&lt;T&gt; <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>(&amp;self) -&gt; <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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; 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>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;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-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/clone.rs.html#273">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/clone.rs.html#275">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&amp;self, dst: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dst</code>. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; 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) -&gt; 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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; 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>&lt;T&gt;,</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) -&gt; 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>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#82-84">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#86">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#87">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#91">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; 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>&lt;T&gt;,</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) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;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>&lt;U&gt;&gt;::<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>&gt;</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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; 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>&lt;T&gt;,</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> = &lt;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>&lt;T&gt;&gt;::<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) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;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>&lt;T&gt;&gt;::<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>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>