Files
2025-04-02 13:41:38 +00:00

139 lines
61 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="A wrapper type for an immutably borrowed value from a [`Bound&#60;&#39;py, T&#62;`]."><title>PyRef in pyo3::pycell - 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-46132b98.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="pyo3" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.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="../../pyo3/index.html">pyo3</a><span class="version">0.24.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">PyRef</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_ptr" title="as_ptr">as_ptr</a></li><li><a href="#method.as_super" title="as_super">as_super</a></li><li><a href="#method.into_ptr" title="into_ptr">into_ptr</a></li><li><a href="#method.into_super" title="into_super">into_super</a></li><li><a href="#method.py" title="py">py</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsPyPointer-for-PyRef%3C'_,+T%3E" title="AsPyPointer">AsPyPointer</a></li><li><a href="#impl-AsRef%3CU%3E-for-PyRef%3C'_,+T%3E" title="AsRef&#60;U&#62;">AsRef&#60;U&#62;</a></li><li><a href="#impl-Debug-for-PyRef%3C'_,+T%3E" title="Debug">Debug</a></li><li><a href="#impl-Deref-for-PyRef%3C'_,+T%3E" title="Deref">Deref</a></li><li><a href="#impl-Drop-for-PyRef%3C'_,+T%3E" title="Drop">Drop</a></li><li><a href="#impl-From%3CPyRef%3C'a,+T%3E%3E-for-Py%3CT%3E" title="From&#60;PyRef&#60;&#39;a, T&#62;&#62;">From&#60;PyRef&#60;&#39;a, T&#62;&#62;</a></li><li><a href="#impl-FromPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" title="FromPyObject&#60;&#39;py&#62;">FromPyObject&#60;&#39;py&#62;</a></li><li><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyRef%3C'_,+T%3E" title="IntoPy&#60;Py&#60;PyAny&#62;&#62;">IntoPy&#60;Py&#60;PyAny&#62;&#62;</a></li><li><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyRef%3C'_,+T%3E" title="IntoPy&#60;Py&#60;PyAny&#62;&#62;">IntoPy&#60;Py&#60;PyAny&#62;&#62;</a></li><li><a href="#impl-IntoPyObject%3C'py%3E-for-%26PyRef%3C'py,+T%3E" title="IntoPyObject&#60;&#39;py&#62;">IntoPyObject&#60;&#39;py&#62;</a></li><li><a href="#impl-IntoPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" title="IntoPyObject&#60;&#39;py&#62;">IntoPyObject&#60;&#39;py&#62;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Send-for-PyRef%3C'p,+T%3E" title="!Send">!Send</a></li><li><a href="#impl-Sync-for-PyRef%3C'p,+T%3E" title="!Sync">!Sync</a></li><li><a href="#impl-Freeze-for-PyRef%3C'p,+T%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-PyRef%3C'p,+T%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-PyRef%3C'p,+T%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-PyRef%3C'p,+T%3E" 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-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-FromPyObjectBound%3C'_,+'py%3E-for-T" title="FromPyObjectBound&#60;&#39;_, &#39;py&#62;">FromPyObjectBound&#60;&#39;_, &#39;py&#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-IntoPyObjectExt%3C'py%3E-for-T" title="IntoPyObjectExt&#60;&#39;py&#62;">IntoPyObjectExt&#60;&#39;py&#62;</a></li><li><a href="#impl-Receiver-for-P" title="Receiver">Receiver</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><a href="index.html">In pyo3::<wbr>pycell</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">pyo3</a>::<wbr><a href="index.html">pycell</a></span><h1>Struct <span class="struct">PyRef</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/pyo3/pycell.rs.html#257-261">Source</a> </span></div><pre class="rust item-decl"><code>pub struct PyRef&lt;'p, T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; { <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 wrapper type for an immutably borrowed value from a [<code>Bound&lt;'py, T&gt;</code>].</p>
<p>See the <a href="../struct.Bound.html" title="struct pyo3::Bound"><code>Bound</code></a> documentation for more information.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<p>You can use <a href="struct.PyRef.html" title="struct pyo3::pycell::PyRef"><code>PyRef</code></a> as an alternative to a <code>&amp;self</code> receiver when</p>
<ul>
<li>you need to access the pointer of the <a href="../struct.Bound.html" title="struct pyo3::Bound"><code>Bound</code></a>, or</li>
<li>you want to get a super class.</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[pyclass(subclass)]
</span><span class="kw">struct </span>Parent {
basename: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pyclass(extends=Parent)]
</span><span class="kw">struct </span>Child {
name: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pymethods]
</span><span class="kw">impl </span>Child {
<span class="attr">#[new]
</span><span class="kw">fn </span>new() -&gt; (<span class="self">Self</span>, Parent) {
(Child { name: <span class="string">"Caterpillar" </span>}, Parent { basename: <span class="string">"Butterfly" </span>})
}
<span class="kw">fn </span>format(slf: PyRef&lt;<span class="lifetime">'_</span>, <span class="self">Self</span>&gt;) -&gt; String {
<span class="comment">// We can get *mut ffi::PyObject from PyRef
</span><span class="kw">let </span>refcnt = <span class="kw">unsafe </span>{ pyo3::ffi::Py_REFCNT(slf.as_ptr()) };
<span class="comment">// We can get &amp;Self::BaseType by as_ref
</span><span class="kw">let </span>basename = slf.as_ref().basename;
<span class="macro">format!</span>(<span class="string">"{}(base: {}, cnt: {})"</span>, slf.name, basename, refcnt)
}
}</code></pre></div>
<p>See the <a href="index.html" title="mod pyo3::pycell">module-level documentation</a> for more information.</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-PyRef%3C'p,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#263-268">Source</a><a href="#impl-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.py" class="method"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#265-267">Source</a><h4 class="code-header">pub fn <a href="#method.py" class="fn">py</a>(&amp;self) -&gt; <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'p&gt;</h4></section></summary><div class="docblock"><p>Returns a <code>Python</code> token that is bound to the lifetime of the <code>PyRef</code>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PyRef%3C'py,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#280-317">Source</a><a href="#impl-PyRef%3C'py,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'py, T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'py, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#290-292">Source</a><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a></h4></section></summary><div class="docblock"><p>Returns the raw FFI pointer represented by self.</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
<p>Callers are responsible for ensuring that the pointer does not outlive self.</p>
<p>The reference is borrowed; callers should not decrease the reference count
when they are finished with the pointer.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_ptr" class="method"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#301-303">Source</a><h4 class="code-header">pub fn <a href="#method.into_ptr" class="fn">into_ptr</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a></h4></section></summary><div class="docblock"><p>Returns an owned raw FFI pointer represented by self.</p>
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
<p>The reference is owned; when finished the caller should either transfer ownership
of the pointer or decrease the reference count (e.g. with <a href="../ffi/fn.Py_DecRef.html" title="fn pyo3::ffi::Py_DecRef"><code>pyo3::ffi::Py_DecRef</code></a>).</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PyRef%3C'p,+T%3E-1" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#319-432">Source</a><a href="#impl-PyRef%3C'p,+T%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T, U&gt; <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;<div class="where">where
T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&lt;BaseType = U&gt;,
U: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_super" class="method"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#369-379">Source</a><h4 class="code-header">pub fn <a href="#method.into_super" class="fn">into_super</a>(self) -&gt; <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, U&gt;</h4></section></summary><div class="docblock"><p>Gets a <code>PyRef&lt;T::BaseType&gt;</code>.</p>
<p>While <code>as_ref()</code> returns a reference of type <code>&amp;T::BaseType</code>, this cannot be
used to get the base of <code>T::BaseType</code>.</p>
<p>But with the help of this method, you can get hold of instances of the
super-superclass when needed.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[pyclass(subclass)]
</span><span class="kw">struct </span>Base1 {
name1: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pyclass(extends=Base1, subclass)]
</span><span class="kw">struct </span>Base2 {
name2: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pyclass(extends=Base2)]
</span><span class="kw">struct </span>Sub {
name3: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pymethods]
</span><span class="kw">impl </span>Sub {
<span class="attr">#[new]
</span><span class="kw">fn </span>new() -&gt; PyClassInitializer&lt;<span class="self">Self</span>&gt; {
PyClassInitializer::from(Base1 { name1: <span class="string">"base1" </span>})
.add_subclass(Base2 { name2: <span class="string">"base2" </span>})
.add_subclass(<span class="self">Self </span>{ name3: <span class="string">"sub" </span>})
}
<span class="kw">fn </span>name(slf: PyRef&lt;<span class="lifetime">'_</span>, <span class="self">Self</span>&gt;) -&gt; String {
<span class="kw">let </span>subname = slf.name3;
<span class="kw">let </span>super_ = slf.into_super();
<span class="macro">format!</span>(<span class="string">"{} {} {}"</span>, super_.as_ref().name1, super_.name2, subname)
}
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_super" class="method"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#424-431">Source</a><h4 class="code-header">pub fn <a href="#method.as_super" class="fn">as_super</a>(&amp;self) -&gt; &amp;<a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, U&gt;</h4></section></summary><div class="docblock"><p>Borrows a shared reference to <code>PyRef&lt;T::BaseType&gt;</code>.</p>
<p>With the help of this method, you can access attributes and call methods
on the superclass without consuming the <code>PyRef&lt;T&gt;</code>. This method can also
be chained to access the super-superclass (and so on).</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[pyclass(subclass)]
</span><span class="kw">struct </span>Base {
base_name: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pymethods]
</span><span class="kw">impl </span>Base {
<span class="kw">fn </span>base_name_len(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; usize {
<span class="self">self</span>.base_name.len()
}
}
<span class="attr">#[pyclass(extends=Base)]
</span><span class="kw">struct </span>Sub {
sub_name: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="attr">#[pymethods]
</span><span class="kw">impl </span>Sub {
<span class="attr">#[new]
</span><span class="kw">fn </span>new() -&gt; (<span class="self">Self</span>, Base) {
(<span class="self">Self </span>{ sub_name: <span class="string">"sub_name" </span>}, Base { base_name: <span class="string">"base_name" </span>})
}
<span class="kw">fn </span>sub_name_len(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; usize {
<span class="self">self</span>.sub_name.len()
}
<span class="kw">fn </span>format_name_lengths(slf: PyRef&lt;<span class="lifetime">'_</span>, <span class="self">Self</span>&gt;) -&gt; String {
<span class="macro">format!</span>(<span class="string">"{} {}"</span>, slf.as_super().base_name_len(), slf.sub_name_len())
}
}</code></pre></div>
</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-AsPyPointer-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#486-490">Source</a><a href="#impl-AsPyPointer-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="../conversion/trait.AsPyPointer.html" title="trait pyo3::conversion::AsPyPointer">AsPyPointer</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ptr-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#487-489">Source</a><a href="#method.as_ptr-1" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.AsPyPointer.html#tymethod.as_ptr" class="fn">as_ptr</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a></h4></section></summary><div class='docblock'>Returns the underlying FFI pointer as a borrowed pointer.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CU%3E-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#270-278">Source</a><a href="#impl-AsRef%3CU%3E-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;U&gt; for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;<div class="where">where
T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&lt;BaseType = U&gt;,
U: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#275-277">Source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&amp;self) -&gt; &amp;T::BaseType</h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#492-496">Source</a><a href="#impl-Debug-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</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/pyo3/pycell.rs.html#493-495">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.85.1/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.85.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#434-441">Source</a><a href="#impl-Deref-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#435">Source</a><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#438-440">Source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#443-450">Source</a><a href="#impl-Drop-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</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/pyo3/pycell.rs.html#444-449">Source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.85.1/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-From%3CPyRef%3C'a,+T%3E%3E-for-Py%3CT%3E" class="impl"><a class="src rightside" href="../../src/pyo3/instance.rs.html#1834-1841">Source</a><a href="#impl-From%3CPyRef%3C'a,+T%3E%3E-for-Py%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'a, T&gt;&gt; for <a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>,</div></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="../../src/pyo3/instance.rs.html#1838-1840">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(pyref: <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'a, T&gt;) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#564-571">Source</a><a href="#impl-FromPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'py, T&gt; <a class="trait" href="../conversion/trait.FromPyObject.html" title="trait pyo3::conversion::FromPyObject">FromPyObject</a>&lt;'py&gt; for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'py, T&gt;<div class="where">where
T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extract_bound" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#568-570">Source</a><a href="#method.extract_bound" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.FromPyObject.html#tymethod.extract_bound" class="fn">extract_bound</a>(obj: &amp;<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a>&lt;'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;) -&gt; <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Extracts <code>Self</code> from the bound smart pointer <code>obj</code>. <a href="../conversion/trait.FromPyObject.html#tymethod.extract_bound">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#460-464">Source</a><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="../conversion/trait.IntoPy.html" title="trait pyo3::conversion::IntoPy">IntoPy</a>&lt;<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a>&lt;<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;&gt; for &amp;<a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_py-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#461-463">Source</a><a href="#method.into_py-1" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPy.html#tymethod.into_py" class="fn">into_py</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'_&gt;) -&gt; <a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: <code>IntoPy</code> is going to be replaced by <code>IntoPyObject</code>. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.</span></div></span><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyRef%3C'_,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#453-457">Source</a><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyRef%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="../conversion/trait.IntoPy.html" title="trait pyo3::conversion::IntoPy">IntoPy</a>&lt;<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a>&lt;<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;&gt; for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'_, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_py" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#454-456">Source</a><a href="#method.into_py" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPy.html#tymethod.into_py" class="fn">into_py</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'_&gt;) -&gt; <a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: <code>IntoPy</code> is going to be replaced by <code>IntoPyObject</code>. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.</span></div></span><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPyObject%3C'py%3E-for-%26PyRef%3C'py,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#476-484">Source</a><a href="#impl-IntoPyObject%3C'py%3E-for-%26PyRef%3C'py,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, 'py, T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a>&lt;'py&gt; for &amp;'a <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'py, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#477">Source</a><a href="#associatedtype.Target-2" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><div class='docblock'>The Python output type</div></details><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#478">Source</a><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a>&lt;'a, 'py, T&gt;</h4></section></summary><div class='docblock'>The smart pointer type to use. <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#479">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/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.into_pyobject-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#481-483">Source</a><a href="#method.into_pyobject-1" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObject.html#tymethod.into_pyobject" class="fn">into_pyobject</a>(self, _py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'py&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>, Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Error" title="type pyo3::conversion::IntoPyObject::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#466-474">Source</a><a href="#impl-IntoPyObject%3C'py%3E-for-PyRef%3C'py,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'py, T: <a class="trait" href="../pyclass/trait.PyClass.html" title="trait pyo3::pyclass::PyClass">PyClass</a>&gt; <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a>&lt;'py&gt; for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'py, T&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#467">Source</a><a href="#associatedtype.Target-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><div class='docblock'>The Python output type</div></details><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#468">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a>&lt;'py, T&gt;</h4></section></summary><div class='docblock'>The smart pointer type to use. <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#469">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/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.into_pyobject" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#471-473">Source</a><a href="#method.into_pyobject" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObject.html#tymethod.into_pyobject" class="fn">into_pyobject</a>(self, _py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'py&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>, Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Error" title="type pyo3::conversion::IntoPyObject::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</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-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-Freeze-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;</h3></section><section id="impl-RefUnwindSafe-for-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-RefUnwindSafe-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-Send-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; !<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;</h3></section><section id="impl-Sync-for-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-Sync-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; !<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;</h3></section><section id="impl-Unpin-for-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-Unpin-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-PyRef%3C'p,+T%3E" class="impl"><a href="#impl-UnwindSafe-for-PyRef%3C'p,+T%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'p, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>&lt;'p, T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/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.85.1/src/core/convert/mod.rs.html#767">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.85.1/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-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#770">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/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-FromPyObjectBound%3C'_,+'py%3E-for-T" class="impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#530-542">Source</a><a href="#impl-FromPyObjectBound%3C'_,+'py%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'py, T&gt; <a class="trait" href="../conversion/trait.FromPyObjectBound.html" title="trait pyo3::conversion::FromPyObjectBound">FromPyObjectBound</a>&lt;'_, 'py&gt; for T<div class="where">where
T: <a class="trait" href="../conversion/trait.FromPyObject.html" title="trait pyo3::conversion::FromPyObject">FromPyObject</a>&lt;'py&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_py_object_bound" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#534-536">Source</a><a href="#method.from_py_object_bound" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.FromPyObjectBound.html#tymethod.from_py_object_bound" class="fn">from_py_object_bound</a>(ob: <a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a>&lt;'_, 'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a>&gt;</h4></section></summary><div class='docblock'>Extracts <code>Self</code> from the bound smart pointer <code>obj</code>. <a href="../conversion/trait.FromPyObjectBound.html#tymethod.from_py_object_bound">Read more</a></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.85.1/src/core/convert/mod.rs.html#750-752">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.85.1/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.85.1/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.85.1/src/core/convert/mod.rs.html#760">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/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.85.1/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-IntoPyObjectExt%3C'py%3E-for-T" class="impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#401">Source</a><a href="#impl-IntoPyObjectExt%3C'py%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'py, T&gt; <a class="trait" href="../conversion/trait.IntoPyObjectExt.html" title="trait pyo3::conversion::IntoPyObjectExt">IntoPyObjectExt</a>&lt;'py&gt; for T<div class="where">where
T: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a>&lt;'py&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_bound_py_any" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#370-375">Source</a><a href="#method.into_bound_py_any" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_bound_py_any" class="fn">into_bound_py_any</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'py&gt;) -&gt; <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a>&lt;<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a>&lt;'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;&gt;</h4></section></summary><div class='docblock'>Converts <code>self</code> into an owned Python object, dropping type information.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_py_any" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#380-385">Source</a><a href="#method.into_py_any" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_py_any" class="fn">into_py_any</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'py&gt;) -&gt; <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a>&lt;<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a>&lt;<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>&gt;&gt;</h4></section></summary><div class='docblock'>Converts <code>self</code> into an owned Python object, dropping type information and unbinding it
from the <code>'py</code> lifetime.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_pyobject_or_pyerr" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#393-398">Source</a><a href="#method.into_pyobject_or_pyerr" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_pyobject_or_pyerr" class="fn">into_pyobject_or_pyerr</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>&lt;'py&gt;) -&gt; <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a>&lt;Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>&gt;</h4></section></summary><div class='docblock'>Converts <code>self</code> into a Python object. <a href="../conversion/trait.IntoPyObjectExt.html#method.into_pyobject_or_pyerr">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Receiver-for-P" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/ops/deref.rs.html#418-420">Source</a><a href="#impl-Receiver-for-P" class="anchor">§</a><h3 class="code-header">impl&lt;P, T&gt; <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Receiver.html" title="trait core::ops::deref::Receiver">Receiver</a> for P<div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target-3" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/ops/deref.rs.html#422">Source</a><a href="#associatedtype.Target-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/ops/deref/trait.Receiver.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>arbitrary_self_types</code>)</span></div></span><div class='docblock'>The target type on which the method may be called.</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.85.1/src/core/convert/mod.rs.html#807-809">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.85.1/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.85.1/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-3" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#811">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/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.85.1/src/core/convert/mod.rs.html#814">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/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.85.1/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.85.1/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.85.1/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.85.1/src/core/convert/mod.rs.html#792-794">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.85.1/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.85.1/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-2" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#796">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.85.1/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.85.1/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.85.1/src/core/convert/mod.rs.html#799">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/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.85.1/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.85.1/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.85.1/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>