Auto Generated Documentation

This commit is contained in:
github-actions[bot]
2021-06-27 15:50:04 +00:00
parent 8522fe43a5
commit e9a232e07d
7516 changed files with 69470 additions and 69332 deletions
+68 -68
View File
@@ -1,7 +1,7 @@
<!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="Marker type that indicates that the GIL is currently held."><meta name="keywords" content="rust, rustlang, rust-lang, Python"><title>pyo3::prelude::Python - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<!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="Marker type that indicates that the GIL is currently held."><meta name="keywords" content="rust, rustlang, rust-lang, Python"><title>Python in pyo3::prelude - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../pyo3/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Struct Python</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.None">None</a><a href="#method.NotImplemented">NotImplemented</a><a href="#method.acquire_gil">acquire_gil</a><a href="#method.allow_threads">allow_threads</a><a href="#method.assume_gil_acquired">assume_gil_acquired</a><a href="#method.cast_as">cast_as</a><a href="#method.check_signals">check_signals</a><a href="#method.checked_cast_as">checked_cast_as</a><a href="#method.eval">eval</a><a href="#method.from_borrowed_ptr">from_borrowed_ptr</a><a href="#method.from_borrowed_ptr_or_err">from_borrowed_ptr_or_err</a><a href="#method.from_borrowed_ptr_or_opt">from_borrowed_ptr_or_opt</a><a href="#method.from_owned_ptr">from_owned_ptr</a><a href="#method.from_owned_ptr_or_err">from_owned_ptr_or_err</a><a href="#method.from_owned_ptr_or_opt">from_owned_ptr_or_opt</a><a href="#method.get_type">get_type</a><a href="#method.import">import</a><a href="#method.is_instance">is_instance</a><a href="#method.is_subclass">is_subclass</a><a href="#method.new_pool">new_pool</a><a href="#method.release">release</a><a href="#method.run">run</a><a href="#method.version">version</a><a href="#method.version_info">version_info</a><a href="#method.with_gil">with_gil</a><a href="#method.xdecref">xdecref</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="../index.html">pyo3</a>::<wbr><a href="index.html">prelude</a></p><div id="sidebar-vars" data-name="Python" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="../index.html">pyo3</a>::<wbr><a href="index.html">prelude</a>::<wbr><a class="struct" href="">Python</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/pyo3/python.rs.html#129" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct Python&lt;'p&gt;(_);</pre></div><div class="docblock"><p>Marker type that indicates that the GIL is currently held.</p>
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></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="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../pyo3/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Struct Python</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.None">None</a><a href="#method.NotImplemented">NotImplemented</a><a href="#method.acquire_gil">acquire_gil</a><a href="#method.allow_threads">allow_threads</a><a href="#method.assume_gil_acquired">assume_gil_acquired</a><a href="#method.cast_as">cast_as</a><a href="#method.check_signals">check_signals</a><a href="#method.checked_cast_as">checked_cast_as</a><a href="#method.eval">eval</a><a href="#method.from_borrowed_ptr">from_borrowed_ptr</a><a href="#method.from_borrowed_ptr_or_err">from_borrowed_ptr_or_err</a><a href="#method.from_borrowed_ptr_or_opt">from_borrowed_ptr_or_opt</a><a href="#method.from_owned_ptr">from_owned_ptr</a><a href="#method.from_owned_ptr_or_err">from_owned_ptr_or_err</a><a href="#method.from_owned_ptr_or_opt">from_owned_ptr_or_opt</a><a href="#method.get_type">get_type</a><a href="#method.import">import</a><a href="#method.is_instance">is_instance</a><a href="#method.is_subclass">is_subclass</a><a href="#method.new_pool">new_pool</a><a href="#method.release">release</a><a href="#method.run">run</a><a href="#method.version">version</a><a href="#method.version_info">version_info</a><a href="#method.with_gil">with_gil</a><a href="#method.xdecref">xdecref</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="../index.html">pyo3</a>::<wbr><a href="index.html">prelude</a></p><div id="sidebar-vars" data-name="Python" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="../index.html">pyo3</a>::<wbr><a href="index.html">prelude</a>::<wbr><a class="struct" href="">Python</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/pyo3/python.rs.html#129" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct Python&lt;'p&gt;(_);</pre></div><div class="docblock"><p>Marker type that indicates that the GIL is currently held.</p>
<p>The <code>Python</code> struct is a zero-sized marker struct that is required for most Python operations.
This is used to indicate that the operation accesses/modifies the Python interpreter state,
and thus can only be called if the Python interpreter is initialized and the
@@ -25,8 +25,8 @@ holding the GIL:</p>
<li>Thread 1s Python interpreter call blocks trying to reacquire the GIL held by thread 2</li>
</ul>
<p>To avoid deadlocking, you should release the GIL before trying to lock a mutex, e.g. with
<a href="../../pyo3/prelude/struct.Python.html#method.allow_threads" title="Python::allow_threads">Python::allow_threads</a>.</p>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'_&gt;</code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#131-159" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.with_gil" class="method"><code>pub fn <a href="#method.with_gil" class="fnname">with_gil</a>&lt;F, R&gt;(f: F) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;) -&gt; R,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#153-158" title="goto source code">[src]</a></h4><div class="docblock"><p>Acquires the global interpreter lock, which allows access to the Python runtime. The
<a href="struct.Python.html#method.allow_threads" title="Python::allow_threads">Python::allow_threads</a>.</p>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'_&gt;</code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#131-159" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.with_gil" class="method"><code>pub fn <a href="#method.with_gil" class="fnname">with_gil</a>&lt;F, R&gt;(f: F) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;) -&gt; R,&nbsp;</span></code><a href="#method.with_gil" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#153-158" title="goto source code">[src]</a></h4><div class="docblock"><p>Acquires the global interpreter lock, which allows access to the Python runtime. The
provided closure F will be executed with the acquired <code>Python</code> marker token.</p>
<p>If the <code>auto-initialize</code> feature is enabled and the Python runtime is not already
initialized, this function will initialize it. See
@@ -38,13 +38,13 @@ initialized.</li>
</ul>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">pyo3</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
<span class="ident">Python</span>::<span class="ident">with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> <span class="op">-</span><span class="op">&gt;</span> <span class="ident">PyResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span> {
<span class="kw">use</span> <span class="ident">pyo3::prelude</span>::<span class="kw-2">*</span>;
<span class="ident">Python::with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> <span class="op">-</span><span class="op">&gt;</span> <span class="ident">PyResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">x</span>: <span class="ident">i32</span> <span class="op">=</span> <span class="ident">py</span>.<span class="ident">eval</span>(<span class="string">&quot;5&quot;</span>, <span class="prelude-val">None</span>, <span class="prelude-val">None</span>)<span class="question-mark">?</span>.<span class="ident">extract</span>()<span class="question-mark">?</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="ident">x</span>, <span class="number">5</span>);
<span class="prelude-val">Ok</span>(())
});</pre></div>
</div></div><h3 id="impl-1" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#161-689" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.acquire_gil" class="method"><code>pub fn <a href="#method.acquire_gil" class="fnname">acquire_gil</a>() -&gt; <a class="struct" href="../../pyo3/prelude/struct.GILGuard.html" title="struct pyo3::prelude::GILGuard">GILGuard</a></code><a class="srclink" href="../../src/pyo3/python.rs.html#184-186" title="goto source code">[src]</a></h4><div class="docblock"><p>Acquires the global interpreter lock, which allows access to the Python runtime.</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-1" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#161-689" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.acquire_gil" class="method"><code>pub fn <a href="#method.acquire_gil" class="fnname">acquire_gil</a>() -&gt; <a class="struct" href="struct.GILGuard.html" title="struct pyo3::prelude::GILGuard">GILGuard</a></code><a href="#method.acquire_gil" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#184-186" title="goto source code">[src]</a></h4><div class="docblock"><p>Acquires the global interpreter lock, which allows access to the Python runtime.</p>
<p>If the <code>auto-initialize</code> feature is enabled and the Python runtime is not already
initialized, this function will initialize it. See
<a href="fn.prepare_freethreaded_python.html">prepare_freethreaded_python()</a> for details.</p>
@@ -65,31 +65,31 @@ an irrecoverable panic.</p>
<li>If the <code>auto-initialize</code> feature is not enabled and the Python interpreter is not
initialized.</li>
</ul>
</div><h4 id="method.allow_threads" class="method"><code>pub fn <a href="#method.allow_threads" class="fnname">allow_threads</a>&lt;T, F&gt;(self, f: F) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#248-273" title="goto source code">[src]</a></h4><div class="docblock"><p>Temporarily releases the <code>GIL</code>, thus allowing other Python threads to run.</p>
</div><h4 id="method.allow_threads" class="method"><code>pub fn <a href="#method.allow_threads" class="fnname">allow_threads</a>&lt;T, F&gt;(self, f: F) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,&nbsp;</span></code><a href="#method.allow_threads" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#248-273" title="goto source code">[src]</a></h4><div class="docblock"><p>Temporarily releases the <code>GIL</code>, thus allowing other Python threads to run.</p>
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">pyo3</span>::<span class="ident">exceptions</span>::<span class="ident">PyRuntimeError</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">sync</span>::<span class="ident">Arc</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">thread</span>;
<span class="kw">use</span> <span class="ident">pyo3::exceptions::PyRuntimeError</span>;
<span class="kw">use</span> <span class="ident">std::sync::Arc</span>;
<span class="kw">use</span> <span class="ident">std::thread</span>;
<span class="attribute">#[<span class="ident">pyfunction</span>]</span>
<span class="kw">fn</span> <span class="ident">parallel_count</span>(<span class="ident">py</span>: <span class="ident">Python</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>, <span class="ident">strings</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>, <span class="ident">query</span>: <span class="ident">String</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">PyResult</span><span class="op">&lt;</span><span class="ident">usize</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">query</span> <span class="op">=</span> <span class="ident">query</span>.<span class="ident">chars</span>().<span class="ident">next</span>().<span class="ident">unwrap</span>();
<span class="ident">py</span>.<span class="ident">allow_threads</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> {
<span class="kw">let</span> <span class="ident">threads</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">strings</span>
.<span class="ident">into_iter</span>()
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">thread</span>::<span class="ident">spawn</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> <span class="ident">s</span>.<span class="ident">chars</span>().<span class="ident">filter</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span> <span class="op">=</span><span class="op">=</span> <span class="ident">query</span>).<span class="ident">count</span>()))
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">thread::spawn</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> <span class="ident">s</span>.<span class="ident">chars</span>().<span class="ident">filter</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span> <span class="op">=</span><span class="op">=</span> <span class="ident">query</span>).<span class="ident">count</span>()))
.<span class="ident">collect</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">sum</span> <span class="op">=</span> <span class="number">0</span>;
<span class="kw">for</span> <span class="ident">t</span> <span class="kw">in</span> <span class="ident">threads</span> {
<span class="ident">sum</span> <span class="op">+</span><span class="op">=</span> <span class="ident">t</span>.<span class="ident">join</span>().<span class="ident">map_err</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="ident">PyRuntimeError</span>::<span class="ident">new_err</span>(()))<span class="question-mark">?</span>;
<span class="ident">sum</span> <span class="op">+</span><span class="op">=</span> <span class="ident">t</span>.<span class="ident">join</span>().<span class="ident">map_err</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="ident">PyRuntimeError::new_err</span>(()))<span class="question-mark">?</span>;
}
<span class="prelude-val">Ok</span>(<span class="ident">sum</span>)
})
}
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">Python</span>::<span class="ident">acquire_gil</span>();
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">Python::acquire_gil</span>();
<span class="kw">let</span> <span class="ident">py</span> <span class="op">=</span> <span class="ident">gil</span>.<span class="ident">python</span>();
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">PyModule</span>::<span class="ident">new</span>(<span class="ident">py</span>, <span class="string">&quot;pcount&quot;</span>).<span class="ident">unwrap</span>();
<span class="ident">m</span>.<span class="ident">add_function</span>(<span class="macro">wrap_pyfunction</span><span class="macro">!</span>(<span class="ident">parallel_count</span>, <span class="ident">m</span>).<span class="ident">unwrap</span>()).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">PyModule::new</span>(<span class="ident">py</span>, <span class="string">&quot;pcount&quot;</span>).<span class="ident">unwrap</span>();
<span class="ident">m</span>.<span class="ident">add_function</span>(<span class="macro">wrap_pyfunction!</span>(<span class="ident">parallel_count</span>, <span class="ident">m</span>).<span class="ident">unwrap</span>()).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">locals</span> <span class="op">=</span> [(<span class="string">&quot;pcount&quot;</span>, <span class="ident">m</span>)].<span class="ident">into_py_dict</span>(<span class="ident">py</span>);
<span class="ident">py</span>.<span class="ident">run</span>(<span class="string">r#&quot;
s = [&quot;Flow&quot;, &quot;my&quot;, &quot;tears&quot;, &quot;the&quot;, &quot;Policeman&quot;, &quot;Said&quot;]
@@ -110,28 +110,28 @@ reacquire the GIL.</p>
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
<div class='information'><div class='tooltip compile_fail'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered compile_fail">
<span class="kw">fn</span> <span class="ident">parallel_print</span>(<span class="ident">py</span>: <span class="ident">Python</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>) {
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="ident">PyString</span>::<span class="ident">new</span>(<span class="ident">py</span>, <span class="string">&quot;This object should not be shared &gt;_&lt;&quot;</span>);
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="ident">PyString::new</span>(<span class="ident">py</span>, <span class="string">&quot;This object should not be shared &gt;_&lt;&quot;</span>);
<span class="ident">py</span>.<span class="ident">allow_threads</span>(<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">s</span>); <span class="comment">// This causes a compile error.</span>
<span class="macro">println!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">s</span>); <span class="comment">// This causes a compile error.</span>
});
}</pre></div>
</div><h4 id="method.eval" class="method"><code>pub fn <a href="#method.eval" class="fnname">eval</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;code: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;globals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../pyo3/types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;locals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../pyo3/types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;<br>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;&amp;'p <a class="struct" href="../../pyo3/prelude/struct.PyAny.html" title="struct pyo3::prelude::PyAny">PyAny</a>&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#289-296" title="goto source code">[src]</a></h4><div class="docblock"><p>Evaluates a Python expression in the given context and returns the result.</p>
</div><h4 id="method.eval" class="method"><code>pub fn <a href="#method.eval" class="fnname">eval</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;code: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;globals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;locals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;<br>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;&amp;'p <a class="struct" href="struct.PyAny.html" title="struct pyo3::prelude::PyAny">PyAny</a>&gt;</code><a href="#method.eval" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#289-296" title="goto source code">[src]</a></h4><div class="docblock"><p>Evaluates a Python expression in the given context and returns the result.</p>
<p>If <code>globals</code> is <code>None</code>, it defaults to Python module <code>__main__</code>.
If <code>locals</code> is <code>None</code>, it defaults to the value of <code>globals</code>.</p>
<h1 id="example-3" class="section-header"><a href="#example-3">Example:</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">py</span>.<span class="ident">eval</span>(<span class="string">&quot;[i * 10 for i in range(5)]&quot;</span>, <span class="prelude-val">None</span>, <span class="prelude-val">None</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">res</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">i64</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">result</span>.<span class="ident">extract</span>().<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">res</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="number">0</span>, <span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>])</pre></div>
</div><h4 id="method.run" class="method"><code>pub fn <a href="#method.run" class="fnname">run</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;code: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;globals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../pyo3/types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;locals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../pyo3/types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;<br>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#322-332" title="goto source code">[src]</a></h4><div class="docblock"><p>Executes one or more Python statements in the given context.</p>
<span class="macro">assert_eq!</span>(<span class="ident">res</span>, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>])</pre></div>
</div><h4 id="method.run" class="method"><code>pub fn <a href="#method.run" class="fnname">run</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;code: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;globals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;locals: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="../types/struct.PyDict.html" title="struct pyo3::types::PyDict">PyDict</a>&gt;<br>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a href="#method.run" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#322-332" title="goto source code">[src]</a></h4><div class="docblock"><p>Executes one or more Python statements in the given context.</p>
<p>If <code>globals</code> is <code>None</code>, it defaults to Python module <code>__main__</code>.
If <code>locals</code> is <code>None</code>, it defaults to the value of <code>globals</code>.</p>
<h1 id="example-4" class="section-header"><a href="#example-4">Example:</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">pyo3</span>::{<span class="ident">types</span>::{<span class="ident">PyBytes</span>, <span class="ident">PyDict</span>}, <span class="ident">prelude</span>::<span class="kw-2">*</span>};
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">pyo3</span>::<span class="ident">Python</span>::<span class="ident">acquire_gil</span>();
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">pyo3::Python::acquire_gil</span>();
<span class="kw">let</span> <span class="ident">py</span> <span class="op">=</span> <span class="ident">gil</span>.<span class="ident">python</span>();
<span class="kw">let</span> <span class="ident">locals</span> <span class="op">=</span> <span class="ident">PyDict</span>::<span class="ident">new</span>(<span class="ident">py</span>);
<span class="kw">let</span> <span class="ident">locals</span> <span class="op">=</span> <span class="ident">PyDict::new</span>(<span class="ident">py</span>);
<span class="ident">py</span>.<span class="ident">run</span>(
<span class="string">r#&quot;
import base64
@@ -143,71 +143,71 @@ ret = base64.b64encode(s.encode(&#39;utf-8&#39;))
).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">ret</span> <span class="op">=</span> <span class="ident">locals</span>.<span class="ident">get_item</span>(<span class="string">&quot;ret&quot;</span>).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">b64</span>: <span class="kw-2">&amp;</span><span class="ident">PyBytes</span> <span class="op">=</span> <span class="ident">ret</span>.<span class="ident">downcast</span>().<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">b64</span>.<span class="ident">as_bytes</span>(), <span class="string">b&quot;SGVsbG8gUnVzdCE=&quot;</span>);</pre></div>
</div><h4 id="method.get_type" class="method"><code>pub fn <a href="#method.get_type" class="fnname">get_type</a>&lt;T&gt;(self) -&gt; &amp;'p <a class="struct" href="../../pyo3/types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#371-376" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python type object for type <code>T</code>.</p>
</div><h4 id="method.import" class="method"><code>pub fn <a href="#method.import" class="fnname">import</a>(self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;&amp;'p <a class="struct" href="../../pyo3/prelude/struct.PyModule.html" title="struct pyo3::prelude::PyModule">PyModule</a>&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#379-381" title="goto source code">[src]</a></h4><div class="docblock"><p>Imports the Python module with the specified name.</p>
</div><h4 id="method.None" class="method"><code>pub fn <a href="#method.None" class="fnname">None</a>(self) -&gt; <a class="type" href="../../pyo3/prelude/type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a></code><a class="srclink" href="../../src/pyo3/python.rs.html#386-388" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python builtin value <code>None</code>.</p>
</div><h4 id="method.NotImplemented" class="method"><code>pub fn <a href="#method.NotImplemented" class="fnname">NotImplemented</a>(self) -&gt; <a class="type" href="../../pyo3/prelude/type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a></code><a class="srclink" href="../../src/pyo3/python.rs.html#393-395" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python builtin value <code>NotImplemented</code>.</p>
</div><h4 id="method.version" class="method"><code>pub fn <a href="#method.version" class="fnname">version</a>(self) -&gt; &amp;'p <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a class="srclink" href="../../src/pyo3/python.rs.html#410-416" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the running Python interpreter version as a string.</p>
<span class="macro">assert_eq!</span>(<span class="ident">b64</span>.<span class="ident">as_bytes</span>(), <span class="string">b&quot;SGVsbG8gUnVzdCE=&quot;</span>);</pre></div>
</div><h4 id="method.get_type" class="method"><code>pub fn <a href="#method.get_type" class="fnname">get_type</a>&lt;T&gt;(self) -&gt; &amp;'p <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,&nbsp;</span></code><a href="#method.get_type" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#371-376" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python type object for type <code>T</code>.</p>
</div><h4 id="method.import" class="method"><code>pub fn <a href="#method.import" class="fnname">import</a>(self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;&amp;'p <a class="struct" href="struct.PyModule.html" title="struct pyo3::prelude::PyModule">PyModule</a>&gt;</code><a href="#method.import" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#379-381" title="goto source code">[src]</a></h4><div class="docblock"><p>Imports the Python module with the specified name.</p>
</div><h4 id="method.None" class="method"><code>pub fn <a href="#method.None" class="fnname">None</a>(self) -&gt; <a class="type" href="type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a></code><a href="#method.None" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#386-388" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python builtin value <code>None</code>.</p>
</div><h4 id="method.NotImplemented" class="method"><code>pub fn <a href="#method.NotImplemented" class="fnname">NotImplemented</a>(self) -&gt; <a class="type" href="type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a></code><a href="#method.NotImplemented" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#393-395" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the Python builtin value <code>NotImplemented</code>.</p>
</div><h4 id="method.version" class="method"><code>pub fn <a href="#method.version" class="fnname">version</a>(self) -&gt; &amp;'p <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href="#method.version" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#410-416" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the running Python interpreter version as a string.</p>
<p>This is a wrapper around the ffi call Py_GetVersion.</p>
<h1 id="example-5" class="section-header"><a href="#example-5">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">Python</span>::<span class="ident">with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> {
<span class="ident">Python::with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> {
<span class="comment">// The full string could be, for example:</span>
<span class="comment">// &quot;3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \n[GCC 4.2.3]&quot;</span>
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">py</span>.<span class="ident">version</span>().<span class="ident">starts_with</span>(<span class="string">&quot;3.&quot;</span>));
<span class="macro">assert!</span>(<span class="ident">py</span>.<span class="ident">version</span>().<span class="ident">starts_with</span>(<span class="string">&quot;3.&quot;</span>));
});</pre></div>
</div><h4 id="method.version_info" class="method"><code>pub fn <a href="#method.version_info" class="fnname">version_info</a>(self) -&gt; <a class="struct" href="../../pyo3/struct.PythonVersionInfo.html" title="struct pyo3::PythonVersionInfo">PythonVersionInfo</a>&lt;'p&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#430-438" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the running Python interpreter version as a struct similar to
</div><h4 id="method.version_info" class="method"><code>pub fn <a href="#method.version_info" class="fnname">version_info</a>(self) -&gt; <a class="struct" href="../struct.PythonVersionInfo.html" title="struct pyo3::PythonVersionInfo">PythonVersionInfo</a>&lt;'p&gt;</code><a href="#method.version_info" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#430-438" title="goto source code">[src]</a></h4><div class="docblock"><p>Gets the running Python interpreter version as a struct similar to
<code>sys.version_info</code>.</p>
<h1 id="example-6" class="section-header"><a href="#example-6">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">Python</span>::<span class="ident">with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> {
<span class="ident">Python::with_gil</span>(<span class="op">|</span><span class="ident">py</span><span class="op">|</span> {
<span class="comment">// PyO3 supports Python 3.6 and up.</span>
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">py</span>.<span class="ident">version_info</span>() <span class="op">&gt;</span><span class="op">=</span> (<span class="number">3</span>, <span class="number">6</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">py</span>.<span class="ident">version_info</span>() <span class="op">&gt;</span><span class="op">=</span> (<span class="number">3</span>, <span class="number">6</span>, <span class="number">0</span>));
<span class="macro">assert!</span>(<span class="ident">py</span>.<span class="ident">version_info</span>() <span class="op">&gt;</span><span class="op">=</span> (<span class="number">3</span>, <span class="number">6</span>));
<span class="macro">assert!</span>(<span class="ident">py</span>.<span class="ident">version_info</span>() <span class="op">&gt;</span><span class="op">=</span> (<span class="number">3</span>, <span class="number">6</span>, <span class="number">0</span>));
});</pre></div>
</div><h4 id="method.checked_cast_as" class="method"><code>pub fn <a href="#method.checked_cast_as" class="fnname">checked_cast_as</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;obj: <a class="type" href="../../pyo3/prelude/type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T, <a class="struct" href="../../pyo3/struct.PyDowncastError.html" title="struct pyo3::PyDowncastError">PyDowncastError</a>&lt;'p&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.PyTryFrom.html" title="trait pyo3::conversion::PyTryFrom">PyTryFrom</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#441-447" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object in the release pool, and tries to downcast to specific type.</p>
</div><h4 id="method.cast_as" class="method"><code>pub unsafe fn <a href="#method.cast_as" class="fnname">cast_as</a>&lt;T&gt;(self, obj: <a class="type" href="../../pyo3/prelude/type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/trait.PyNativeType.html" title="trait pyo3::PyNativeType">PyNativeType</a> + <a class="trait" href="../../pyo3/type_object/trait.PyTypeInfo.html" title="trait pyo3::type_object::PyTypeInfo">PyTypeInfo</a>,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#455-461" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object in the release pool, and does an unchecked downcast
</div><h4 id="method.checked_cast_as" class="method"><code>pub fn <a href="#method.checked_cast_as" class="fnname">checked_cast_as</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;obj: <a class="type" href="type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T, <a class="struct" href="../struct.PyDowncastError.html" title="struct pyo3::PyDowncastError">PyDowncastError</a>&lt;'p&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.PyTryFrom.html" title="trait pyo3::conversion::PyTryFrom">PyTryFrom</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.checked_cast_as" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#441-447" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object in the release pool, and tries to downcast to specific type.</p>
</div><h4 id="method.cast_as" class="method"><code>pub unsafe fn <a href="#method.cast_as" class="fnname">cast_as</a>&lt;T&gt;(self, obj: <a class="type" href="type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../trait.PyNativeType.html" title="trait pyo3::PyNativeType">PyNativeType</a> + <a class="trait" href="../type_object/trait.PyTypeInfo.html" title="trait pyo3::type_object::PyTypeInfo">PyTypeInfo</a>,&nbsp;</span></code><a href="#method.cast_as" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#455-461" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object in the release pool, and does an unchecked downcast
to the specific type.</p>
<h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_owned_ptr" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr" class="fnname">from_owned_ptr</a>&lt;T&gt;(self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#470-475" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object pointer in the release pool,
</div><h4 id="method.from_owned_ptr" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr" class="fnname">from_owned_ptr</a>&lt;T&gt;(self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_owned_ptr" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#470-475" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the object pointer in the release pool,
and does an unchecked downcast to the specific type.</p>
<h1 id="safety-1" class="section-header"><a href="#safety-1">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_owned_ptr_or_err" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr_or_err" class="fnname">from_owned_ptr_or_err</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#486-491" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the owned object pointer in the release pool.</p>
</div><h4 id="method.from_owned_ptr_or_err" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr_or_err" class="fnname">from_owned_ptr_or_err</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_owned_ptr_or_err" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#486-491" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the owned object pointer in the release pool.</p>
<p>Returns <code>Err(PyErr)</code> if the pointer is NULL.
Does an unchecked downcast to the specific type.</p>
<h1 id="safety-2" class="section-header"><a href="#safety-2">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_owned_ptr_or_opt" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr_or_opt" class="fnname">from_owned_ptr_or_opt</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#502-507" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the owned object pointer in release pool.</p>
</div><h4 id="method.from_owned_ptr_or_opt" class="method"><code>pub unsafe fn <a href="#method.from_owned_ptr_or_opt" class="fnname">from_owned_ptr_or_opt</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_owned_ptr_or_opt" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#502-507" title="goto source code">[src]</a></h4><div class="docblock"><p>Registers the owned object pointer in release pool.</p>
<p>Returns <code>None</code> if the pointer is NULL.
Does an unchecked downcast to the specific type.</p>
<h1 id="safety-3" class="section-header"><a href="#safety-3">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_borrowed_ptr" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr" class="fnname">from_borrowed_ptr</a>&lt;T&gt;(self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#517-522" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
</div><h4 id="method.from_borrowed_ptr" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr" class="fnname">from_borrowed_ptr</a>&lt;T&gt;(self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_borrowed_ptr" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#517-522" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
<p>Panics if the pointer is NULL.</p>
<h1 id="safety-4" class="section-header"><a href="#safety-4">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_borrowed_ptr_or_err" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr_or_err" class="fnname">from_borrowed_ptr_or_err</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#532-537" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
</div><h4 id="method.from_borrowed_ptr_or_err" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr_or_err" class="fnname">from_borrowed_ptr_or_err</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_borrowed_ptr_or_err" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#532-537" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
<p>Returns <code>Err(PyErr)</code> if the pointer is NULL.</p>
<h1 id="safety-5" class="section-header"><a href="#safety-5">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.from_borrowed_ptr_or_opt" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr_or_opt" class="fnname">from_borrowed_ptr_or_opt</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../../pyo3/ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#547-552" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
</div><h4 id="method.from_borrowed_ptr_or_opt" class="method"><code>pub unsafe fn <a href="#method.from_borrowed_ptr_or_opt" class="fnname">from_borrowed_ptr_or_opt</a>&lt;T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../ffi/struct.PyObject.html" title="struct pyo3::ffi::PyObject">PyObject</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'p </a>T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.FromPyPointer.html" title="trait pyo3::conversion::FromPyPointer">FromPyPointer</a>&lt;'p&gt;,&nbsp;</span></code><a href="#method.from_borrowed_ptr_or_opt" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#547-552" title="goto source code">[src]</a></h4><div class="docblock"><p>Does an unchecked downcast to the specific type.</p>
<p>Returns <code>None</code> if the pointer is NULL.</p>
<h1 id="safety-6" class="section-header"><a href="#safety-6">Safety</a></h1>
<p>Callers must ensure that ensure that the cast is valid.</p>
</div><h4 id="method.is_instance" class="method"><code>pub fn <a href="#method.is_instance" class="fnname">is_instance</a>&lt;T:&nbsp;<a class="trait" href="../../pyo3/type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>, V:&nbsp;<a class="trait" href="../../pyo3/conversion/trait.AsPyPointer.html" title="trait pyo3::conversion::AsPyPointer">AsPyPointer</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;obj: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>V<br>) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#558-560" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please use obj.is_instance::&lt;T&gt;() instead</p>
</div><h4 id="method.is_instance" class="method"><code>pub fn <a href="#method.is_instance" class="fnname">is_instance</a>&lt;T:&nbsp;<a class="trait" href="../type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>, V:&nbsp;<a class="trait" href="../conversion/trait.AsPyPointer.html" title="trait pyo3::conversion::AsPyPointer">AsPyPointer</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;obj: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>V<br>) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a href="#method.is_instance" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#558-560" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please use obj.is_instance::&lt;T&gt;() instead</p>
</div></div><div class="docblock"><p>Checks whether <code>obj</code> is an instance of type <code>T</code>.</p>
<p>This is equivalent to the Python <code>isinstance</code> function.</p>
</div><h4 id="method.is_subclass" class="method"><code>pub fn <a href="#method.is_subclass" class="fnname">is_subclass</a>&lt;T, U&gt;(self) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../../pyo3/type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#569-575" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please use T::type_object(py).is_subclass::&lt;U&gt;() instead</p>
</div><h4 id="method.is_subclass" class="method"><code>pub fn <a href="#method.is_subclass" class="fnname">is_subclass</a>&lt;T, U&gt;(self) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../type_object/trait.PyTypeObject.html" title="trait pyo3::type_object::PyTypeObject">PyTypeObject</a>,&nbsp;</span></code><a href="#method.is_subclass" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#569-575" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please use T::type_object(py).is_subclass::&lt;U&gt;() instead</p>
</div></div><div class="docblock"><p>Checks whether type <code>T</code> is subclass of type <code>U</code>.</p>
<p>This is equivalent to the Python <code>issubclass</code> function.</p>
</div><h4 id="method.release" class="method"><code>pub fn <a href="#method.release" class="fnname">release</a>&lt;T&gt;(self, ob: T) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../pyo3/conversion/trait.IntoPyPointer.html" title="trait pyo3::conversion::IntoPyPointer">IntoPyPointer</a>,&nbsp;</span></code><a class="srclink" href="../../src/pyo3/python.rs.html#580-590" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please just drop ob instead</p>
</div><h4 id="method.release" class="method"><code>pub fn <a href="#method.release" class="fnname">release</a>&lt;T&gt;(self, ob: T) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../conversion/trait.IntoPyPointer.html" title="trait pyo3::conversion::IntoPyPointer">IntoPyPointer</a>,&nbsp;</span></code><a href="#method.release" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#580-590" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please just drop ob instead</p>
</div></div><div class="docblock"><p>Releases a PyObject reference.</p>
</div><h4 id="method.xdecref" class="method"><code>pub fn <a href="#method.xdecref" class="fnname">xdecref</a>&lt;T:&nbsp;<a class="trait" href="../../pyo3/conversion/trait.IntoPyPointer.html" title="trait pyo3::conversion::IntoPyPointer">IntoPyPointer</a>&gt;(self, ptr: T)</code><a class="srclink" href="../../src/pyo3/python.rs.html#595-597" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please just drop obj instead</p>
</div><h4 id="method.xdecref" class="method"><code>pub fn <a href="#method.xdecref" class="fnname">xdecref</a>&lt;T:&nbsp;<a class="trait" href="../conversion/trait.IntoPyPointer.html" title="trait pyo3::conversion::IntoPyPointer">IntoPyPointer</a>&gt;(self, ptr: T)</code><a href="#method.xdecref" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#595-597" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 0.13.0: <p>Please just drop obj instead</p>
</div></div><div class="docblock"><p>Releases a <code>ffi::PyObject</code> pointer.</p>
</div><h4 id="method.check_signals" class="method"><code>pub fn <a href="#method.check_signals" class="fnname">check_signals</a>(self) -&gt; <a class="type" href="../../pyo3/prelude/type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#610-617" title="goto source code">[src]</a></h4><div class="docblock"><p>Lets the Python interpreter check for pending signals and invoke the
</div><h4 id="method.check_signals" class="method"><code>pub fn <a href="#method.check_signals" class="fnname">check_signals</a>(self) -&gt; <a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a href="#method.check_signals" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#610-617" title="goto source code">[src]</a></h4><div class="docblock"><p>Lets the Python interpreter check for pending signals and invoke the
corresponding signal handlers. This can run arbitrary Python code.</p>
<p>If an exception is raised by the signal handler, or the default signal
handler raises an exception (such as <code>KeyboardInterrupt</code> for <code>SIGINT</code>),
@@ -216,7 +216,7 @@ an <code>Err</code> is returned.</p>
practice to call this regularly in a long-running calculation since
SIGINT and other signals handled by Python code are left pending for its
entire duration.</p>
</div><h4 id="method.assume_gil_acquired" class="method"><code>pub unsafe fn <a href="#method.assume_gil_acquired" class="fnname">assume_gil_acquired</a>() -&gt; <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#630-632" title="goto source code">[src]</a></h4><div class="docblock"><p>Retrieves a Python instance under the assumption that the GIL is already
</div><h4 id="method.assume_gil_acquired" class="method"><code>pub unsafe fn <a href="#method.assume_gil_acquired" class="fnname">assume_gil_acquired</a>() -&gt; <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#method.assume_gil_acquired" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#630-632" title="goto source code">[src]</a></h4><div class="docblock"><p>Retrieves a Python instance under the assumption that the GIL is already
acquired at this point, and stays acquired for the lifetime <code>'p</code>.</p>
<p>Because the output lifetime <code>'p</code> is not connected to any input parameter,
care must be taken that the compiler infers an appropriate lifetime for <code>'p</code>
@@ -224,7 +224,7 @@ when calling this function.</p>
<h1 id="safety-7" class="section-header"><a href="#safety-7">Safety</a></h1>
<p>The lifetime <code>'p</code> must be shorter than the period you <em>assume</em> that you have GIL.
I.e., <code>Python&lt;'static&gt;</code> is always <em>really</em> unsafe.</p>
</div><h4 id="method.new_pool" class="method"><code>pub unsafe fn <a href="#method.new_pool" class="fnname">new_pool</a>(self) -&gt; <a class="struct" href="../../pyo3/struct.GILPool.html" title="struct pyo3::GILPool">GILPool</a></code><a class="srclink" href="../../src/pyo3/python.rs.html#686-688" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a new pool for managing PyO3s owned references.</p>
</div><h4 id="method.new_pool" class="method"><code>pub unsafe fn <a href="#method.new_pool" class="fnname">new_pool</a>(self) -&gt; <a class="struct" href="../struct.GILPool.html" title="struct pyo3::GILPool">GILPool</a></code><a href="#method.new_pool" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#686-688" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a new pool for managing PyO3s owned references.</p>
<p>When this <code>GILPool</code> is dropped, all PyO3 owned references created after this <code>GILPool</code> will
all have their Python reference counts decremented, potentially allowing Python to drop
the corresponding Python objects.</p>
@@ -235,7 +235,7 @@ to use this API to clear memory, as PyO3 usually does not clear memory until the
released.</p>
<h1 id="example-7" class="section-header"><a href="#example-7">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">Python</span>::<span class="ident">acquire_gil</span>();
<span class="kw">let</span> <span class="ident">gil</span> <span class="op">=</span> <span class="ident">Python::acquire_gil</span>();
<span class="kw">let</span> <span class="ident">py</span> <span class="op">=</span> <span class="ident">gil</span>.<span class="ident">python</span>();
<span class="comment">// Some long-running process like a webserver, which never releases the GIL.</span>
@@ -268,20 +268,20 @@ safe for reasons discussed above. Care must be taken to never access these retur
after the <code>GILPool</code> is dropped, unless they are converted to <code>Py&lt;T&gt;</code> <em>before</em> the pool
is dropped.</li>
</ul>
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id="impl-Copy" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Copy" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../pyo3/prelude/struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#544-548" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#533-540" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#537" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</div></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Clone" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.clone" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#method.clone" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id="method.clone_from" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div></details><h3 id="impl-Copy" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Copy" class="anchor"></a><a class="srclink" href="../../src/pyo3/python.rs.html#128" title="goto source code">[src]</a></h3></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><h3 id="impl-Send" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Send" class="anchor"></a></h3><h3 id="impl-Sync" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Sync" class="anchor"></a></h3><h3 id="impl-Unpin" class="impl"><code class="in-band">impl&lt;'p&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-Unpin" class="anchor"></a></h3><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl&lt;'p&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Python.html" title="struct pyo3::prelude::Python">Python</a>&lt;'p&gt;</code><a href="#impl-UnwindSafe" class="anchor"></a></h3></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.type_id" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a href="#method.type_id" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a href="#method.borrow" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a href="#method.borrow_mut" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#544-548" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.from" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a href="#method.from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#533-540" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.into" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</code><a href="#method.into" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#537" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Owned" class="type trait-impl"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code><a href="#associatedtype.Owned" class="anchor"></a></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id="method.to_owned" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</code><a href="#method.to_owned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id="method.clone_into" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a href="#method.clone_into" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#581-590" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#587" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#567-576" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#573" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="pyo3" data-search-js="../../search-index.js"></div>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#581-590" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Error" class="type trait-impl"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code><a href="#associatedtype.Error" class="anchor"></a></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_from" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a href="#method.try_from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#587" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#567-576" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Error-1" class="type trait-impl"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code><a href="#associatedtype.Error-1" class="anchor"></a></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_into" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/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/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a href="#method.try_into" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#573" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="pyo3" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>