Files
phy/rstar/trait.RTreeParams.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

44 lines
12 KiB
HTML
Raw Permalink 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="Defines static parameters for an r-tree."><title>RTreeParams in rstar - 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="rstar" 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 trait"><!--[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="../rstar/index.html">rstar</a><span class="version">0.12.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">RTree<wbr>Params</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-associated-consts">Required Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.MAX_SIZE" title="MAX_SIZE">MAX_SIZE</a></li><li><a href="#associatedconstant.MIN_SIZE" title="MIN_SIZE">MIN_SIZE</a></li><li><a href="#associatedconstant.REINSERTION_COUNT" title="REINSERTION_COUNT">REINSERTION_COUNT</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.DefaultInsertionStrategy" title="DefaultInsertionStrategy">DefaultInsertionStrategy</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rstar</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">rstar</a></span><h1>Trait <span class="trait">RTreeParams</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/rstar/params.rs.html#37-57">Source</a> </span></div><pre class="rust item-decl"><code>pub trait RTreeParams: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> {
type <a href="#associatedtype.DefaultInsertionStrategy" class="associatedtype">DefaultInsertionStrategy</a>: <a class="trait" href="trait.InsertionStrategy.html" title="trait rstar::InsertionStrategy">InsertionStrategy</a>;
const <a href="#associatedconstant.MIN_SIZE" class="constant">MIN_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>;
const <a href="#associatedconstant.MAX_SIZE" class="constant">MAX_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>;
const <a href="#associatedconstant.REINSERTION_COUNT" class="constant">REINSERTION_COUNT</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Defines static parameters for an r-tree.</p>
<p>Internally, an r-tree contains several nodes, similar to a b-tree. These parameters change
the size of these nodes and can be used to fine-tune the trees performance.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rstar::{RTreeParams, RTree, RStarInsertionStrategy};
<span class="comment">// This example uses an rtree with larger internal nodes.
</span><span class="kw">struct </span>LargeNodeParameters;
<span class="kw">impl </span>RTreeParams <span class="kw">for </span>LargeNodeParameters
{
<span class="kw">const </span>MIN_SIZE: usize = <span class="number">10</span>;
<span class="kw">const </span>MAX_SIZE: usize = <span class="number">30</span>;
<span class="kw">const </span>REINSERTION_COUNT: usize = <span class="number">5</span>;
<span class="kw">type </span>DefaultInsertionStrategy = RStarInsertionStrategy;
}
<span class="comment">// Optional but helpful: Define a type alias for the new r-tree
</span><span class="kw">type </span>LargeNodeRTree&lt;T&gt; = RTree&lt;T, LargeNodeParameters&gt;;
<span class="comment">// The only difference from now on is the usage of "new_with_params" instead of "new"
</span><span class="kw">let </span><span class="kw-2">mut </span>large_node_tree: LargeNodeRTree&lt;<span class="kw">_</span>&gt; = RTree::new_with_params();
<span class="comment">// Using the r-tree should allow inference for the point type
</span>large_node_tree.insert([<span class="number">1.0</span>, -<span class="number">1.0f32</span>]);
<span class="comment">// There is also a bulk load method with parameters:
</span><span class="kw">let </span>tree: LargeNodeRTree&lt;<span class="kw">_</span>&gt; = RTree::bulk_load_with_params(some_elements);</code></pre></div>
</div></details><h2 id="required-associated-consts" class="section-header">Required Associated Constants<a href="#required-associated-consts" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedconstant.MIN_SIZE" class="method"><a class="src rightside" href="../src/rstar/params.rs.html#44">Source</a><h4 class="code-header">const <a href="#associatedconstant.MIN_SIZE" class="constant">MIN_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>The minimum size of an internal node. <code>MIN_SIZE</code> must be greater than zero, and up to half
as large as <code>MAX_SIZE</code>.</p>
<p>Choosing a value around one half or one third of <code>MAX_SIZE</code> is recommended. Larger values
should yield slightly better tree quality, while lower values may benefit insertion
performance.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_SIZE" class="method"><a class="src rightside" href="../src/rstar/params.rs.html#48">Source</a><h4 class="code-header">const <a href="#associatedconstant.MAX_SIZE" class="constant">MAX_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>The maximum size of an internal node. Larger values will improve insertion performance
but increase the average query time.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.REINSERTION_COUNT" class="method"><a class="src rightside" href="../src/rstar/params.rs.html#53">Source</a><h4 class="code-header">const <a href="#associatedconstant.REINSERTION_COUNT" class="constant">REINSERTION_COUNT</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>The number of nodes that the insertion strategy tries to occasionally reinsert to
maintain a good tree quality. Must be smaller than <code>MAX_SIZE</code> - <code>MIN_SIZE</code>.
Larger values will improve query times but increase insertion time.</p>
</div></details></div><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.DefaultInsertionStrategy" class="method"><a class="src rightside" href="../src/rstar/params.rs.html#56">Source</a><h4 class="code-header">type <a href="#associatedtype.DefaultInsertionStrategy" class="associatedtype">DefaultInsertionStrategy</a>: <a class="trait" href="trait.InsertionStrategy.html" title="trait rstar::InsertionStrategy">InsertionStrategy</a></h4></section></summary><div class="docblock"><p>The insertion strategy which is used when calling <a href="struct.RTree.html#method.insert" title="method rstar::RTree::insert">RTree::insert</a>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-RTreeParams-for-DefaultParams" class="impl"><a class="src rightside" href="../src/rstar/params.rs.html#63-68">Source</a><a href="#impl-RTreeParams-for-DefaultParams" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.RTreeParams.html" title="trait rstar::RTreeParams">RTreeParams</a> for <a class="struct" href="struct.DefaultParams.html" title="struct rstar::DefaultParams">DefaultParams</a></h3></section></summary><div class="impl-items"><section id="associatedconstant.MIN_SIZE-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/rstar/params.rs.html#64">Source</a><a href="#associatedconstant.MIN_SIZE-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.MIN_SIZE" class="constant">MIN_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a> = 3usize</h4></section><section id="associatedconstant.MAX_SIZE-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/rstar/params.rs.html#65">Source</a><a href="#associatedconstant.MAX_SIZE-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.MAX_SIZE" class="constant">MAX_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a> = 6usize</h4></section><section id="associatedconstant.REINSERTION_COUNT-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/rstar/params.rs.html#66">Source</a><a href="#associatedconstant.REINSERTION_COUNT-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.REINSERTION_COUNT" class="constant">REINSERTION_COUNT</a>: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a> = 2usize</h4></section><section id="associatedtype.DefaultInsertionStrategy-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/rstar/params.rs.html#67">Source</a><a href="#associatedtype.DefaultInsertionStrategy-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.DefaultInsertionStrategy" class="associatedtype">DefaultInsertionStrategy</a> = <a class="enum" href="enum.RStarInsertionStrategy.html" title="enum rstar::RStarInsertionStrategy">RStarInsertionStrategy</a></h4></section></div></details></div><script src="../trait.impl/rstar/params/trait.RTreeParams.js" async></script></section></div></main></body></html>