84 lines
30 KiB
HTML
84 lines
30 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="Generates a Legend"><title>Legend in plotpy - 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="plotpy" 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="../plotpy/index.html">plotpy</a><span class="version">0.5.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Legend</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="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.draw" title="draw">draw</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.set_fontsize" title="set_fontsize">set_fontsize</a></li><li><a href="#method.set_handle_len" title="set_handle_len">set_handle_len</a></li><li><a href="#method.set_location" title="set_location">set_location</a></li><li><a href="#method.set_num_col" title="set_num_col">set_num_col</a></li><li><a href="#method.set_outside" title="set_outside">set_outside</a></li><li><a href="#method.set_show_frame" title="set_show_frame">set_show_frame</a></li><li><a href="#method.set_x_coords" title="set_x_coords">set_x_coords</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-GraphMaker-for-Legend" title="GraphMaker">GraphMaker</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Legend" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Legend" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Legend" title="Send">Send</a></li><li><a href="#impl-Sync-for-Legend" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Legend" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Legend" 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<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-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></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate plotpy</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">plotpy</a></span><h1>Struct <span class="struct">Legend</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/plotpy/legend.rs.html#68-77">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Legend { <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>Generates a Legend</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>plotpy::{linspace, Curve, Legend, Plot, StrError};
|
||
|
||
<span class="kw">fn </span>main() -> <span class="prelude-ty">Result</span><(), StrError> {
|
||
<span class="comment">// generate (x,y) points
|
||
</span><span class="kw">let </span>x = linspace(<span class="number">0.0</span>, <span class="number">5.0</span>, <span class="number">6</span>);
|
||
<span class="kw">let </span>y1: Vec<<span class="kw">_</span>> = x.iter().map(|v| <span class="number">0.5 </span>* <span class="kw-2">*</span>v).collect();
|
||
<span class="kw">let </span>y2: Vec<<span class="kw">_</span>> = x.iter().map(|v| <span class="number">1.0 </span>* <span class="kw-2">*</span>v).collect();
|
||
<span class="kw">let </span>y3: Vec<<span class="kw">_</span>> = x.iter().map(|v| <span class="number">1.5 </span>* <span class="kw-2">*</span>v).collect();
|
||
<span class="kw">let </span>y4: Vec<<span class="kw">_</span>> = x.iter().map(|v| <span class="number">2.0 </span>* <span class="kw-2">*</span>v).collect();
|
||
|
||
<span class="comment">// configure and draw curves
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>curve1 = Curve::new();
|
||
<span class="kw">let </span><span class="kw-2">mut </span>curve2 = Curve::new();
|
||
<span class="kw">let </span><span class="kw-2">mut </span>curve3 = Curve::new();
|
||
<span class="kw">let </span><span class="kw-2">mut </span>curve4 = Curve::new();
|
||
curve1.set_label(<span class="string">"y = 0.5 x"</span>);
|
||
curve2.set_label(<span class="string">"y = 1.0 x"</span>);
|
||
curve3.set_label(<span class="string">"y = 1.5 x"</span>);
|
||
curve4.set_label(<span class="string">"y = 2.0 x"</span>);
|
||
curve1.draw(<span class="kw-2">&</span>x, <span class="kw-2">&</span>y1);
|
||
curve2.draw(<span class="kw-2">&</span>x, <span class="kw-2">&</span>y2);
|
||
curve3.draw(<span class="kw-2">&</span>x, <span class="kw-2">&</span>y3);
|
||
curve4.draw(<span class="kw-2">&</span>x, <span class="kw-2">&</span>y4);
|
||
|
||
<span class="comment">// configure and draw legends
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>legend1 = Legend::new();
|
||
legend1.set_fontsize(<span class="number">14.0</span>)
|
||
.set_handle_len(<span class="number">6.0</span>)
|
||
.set_num_col(<span class="number">2</span>)
|
||
.set_outside(<span class="bool-val">true</span>)
|
||
.set_show_frame(<span class="bool-val">false</span>);
|
||
legend1.draw();
|
||
<span class="kw">let </span><span class="kw-2">mut </span>legend2 = Legend::new();
|
||
legend2.draw();
|
||
|
||
<span class="comment">// add curves and legends to subplots
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>plot = Plot::new();
|
||
plot.set_subplot(<span class="number">2</span>, <span class="number">1</span>, <span class="number">1</span>)
|
||
.add(<span class="kw-2">&</span>curve1)
|
||
.add(<span class="kw-2">&</span>curve2)
|
||
.add(<span class="kw-2">&</span>curve3)
|
||
.add(<span class="kw-2">&</span>curve4)
|
||
.add(<span class="kw-2">&</span>legend1);
|
||
plot.set_subplot(<span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>)
|
||
.add(<span class="kw-2">&</span>curve1)
|
||
.add(<span class="kw-2">&</span>curve2)
|
||
.add(<span class="kw-2">&</span>curve3)
|
||
.add(<span class="kw-2">&</span>curve4)
|
||
.add(<span class="kw-2">&</span>legend2);
|
||
|
||
<span class="comment">// save figure
|
||
</span>plot.save(<span class="string">"/tmp/plotpy/doc_tests/doc_legend.svg"</span>)<span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div>
|
||
<p><img src="https://raw.githubusercontent.com/cpmech/plotpy/main/figures/doc_legend.svg" alt="doc_legend.svg" /></p>
|
||
<p>See also integration tests in the <a href="https://github.com/cpmech/plotpy/tree/main/tests">tests directory</a></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-Legend" class="impl"><a class="src rightside" href="../src/plotpy/legend.rs.html#79-188">Source</a><a href="#impl-Legend" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Legend.html" title="struct plotpy::Legend">Legend</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/plotpy/legend.rs.html#81-92">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates a new Legend object</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#95-107">Source</a><h4 class="code-header">pub fn <a href="#method.draw" class="fn">draw</a>(&mut self)</h4></section></summary><div class="docblock"><p>Draws legend</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_fontsize" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#110-113">Source</a><h4 class="code-header">pub fn <a href="#method.set_fontsize" class="fn">set_fontsize</a>(&mut self, fontsize: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets the fontsize</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_handle_len" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#116-119">Source</a><h4 class="code-header">pub fn <a href="#method.set_handle_len" class="fn">set_handle_len</a>(&mut self, length: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets the length of legend’s indicator line</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_num_col" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#122-125">Source</a><h4 class="code-header">pub fn <a href="#method.set_num_col" class="fn">set_num_col</a>(&mut self, num_columns: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.usize.html">usize</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets the number of columns</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_location" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#133-136">Source</a><h4 class="code-header">pub fn <a href="#method.set_location" class="fn">set_location</a>(&mut self, location: &<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.str.html">str</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets the location</p>
|
||
<p>Options:</p>
|
||
<ul>
|
||
<li>“best”, “right”, “center left”</li>
|
||
<li>Note: Only used if outside == false</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_outside" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#139-142">Source</a><h4 class="code-header">pub fn <a href="#method.set_outside" class="fn">set_outside</a>(&mut self, flag: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets option to put legend outside of plot area</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_show_frame" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#145-148">Source</a><h4 class="code-header">pub fn <a href="#method.set_show_frame" class="fn">set_show_frame</a>(&mut self, flag: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a>) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets option to show frame around legend</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_x_coords" class="method"><a class="src rightside" href="../src/plotpy/legend.rs.html#153-156">Source</a><h4 class="code-header">pub fn <a href="#method.set_x_coords" class="fn">set_x_coords</a>(&mut self, coords: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f64.html">f64</a>]) -> &mut Self</h4></section></summary><div class="docblock"><p>Sets the normalized coordinates when drawing an outside legend</p>
|
||
<p>Example: <code>[0.0, 1.02, 1.0, 0.102]</code></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-GraphMaker-for-Legend" class="impl"><a class="src rightside" href="../src/plotpy/legend.rs.html#190-197">Source</a><a href="#impl-GraphMaker-for-Legend" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.GraphMaker.html" title="trait plotpy::GraphMaker">GraphMaker</a> for <a class="struct" href="struct.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get_buffer" class="method trait-impl"><a class="src rightside" href="../src/plotpy/legend.rs.html#191-193">Source</a><a href="#method.get_buffer" class="anchor">§</a><h4 class="code-header">fn <a href="trait.GraphMaker.html#tymethod.get_buffer" class="fn">get_buffer</a><'a>(&'a self) -> &'a <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Returns the text buffer with Python3 commands</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_buffer" class="method trait-impl"><a class="src rightside" href="../src/plotpy/legend.rs.html#194-196">Source</a><a href="#method.clear_buffer" class="anchor">§</a><h4 class="code-header">fn <a href="trait.GraphMaker.html#tymethod.clear_buffer" class="fn">clear_buffer</a>(&mut self)</h4></section></summary><div class='docblock'>Clear the text buffer with Python commands</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-Legend" class="impl"><a href="#impl-Freeze-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section><section id="impl-RefUnwindSafe-for-Legend" class="impl"><a href="#impl-RefUnwindSafe-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section><section id="impl-Send-for-Legend" class="impl"><a href="#impl-Send-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section><section id="impl-Sync-for-Legend" class="impl"><a href="#impl-Sync-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section><section id="impl-Unpin-for-Legend" class="impl"><a href="#impl-Unpin-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</a></h3></section><section id="impl-UnwindSafe-for-Legend" class="impl"><a href="#impl-UnwindSafe-for-Legend" 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.Legend.html" title="struct plotpy::Legend">Legend</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-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></div></section></div></main></body></html> |