271 lines
129 KiB
HTML
271 lines
129 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Represents a Python exception."><title>PyErr in pyo3::prelude - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="pyo3" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../pyo3/index.html">pyo3</a><span class="version">0.24.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">PyErr</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.cause" title="cause">cause</a></li><li><a href="#method.clone_ref" title="clone_ref">clone_ref</a></li><li><a href="#method.display" title="display">display</a></li><li><a href="#method.fetch" title="fetch">fetch</a></li><li><a href="#method.from_type" title="from_type">from_type</a></li><li><a href="#method.from_type_bound" title="from_type_bound">from_type_bound</a></li><li><a href="#method.from_value" title="from_value">from_value</a></li><li><a href="#method.from_value_bound" title="from_value_bound">from_value_bound</a></li><li><a href="#method.get_type" title="get_type">get_type</a></li><li><a href="#method.get_type_bound" title="get_type_bound">get_type_bound</a></li><li><a href="#method.into_value" title="into_value">into_value</a></li><li><a href="#method.is_instance" title="is_instance">is_instance</a></li><li><a href="#method.is_instance_bound" title="is_instance_bound">is_instance_bound</a></li><li><a href="#method.is_instance_of" title="is_instance_of">is_instance_of</a></li><li><a href="#method.matches" title="matches">matches</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_type" title="new_type">new_type</a></li><li><a href="#method.new_type_bound" title="new_type_bound">new_type_bound</a></li><li><a href="#method.occurred" title="occurred">occurred</a></li><li><a href="#method.print" title="print">print</a></li><li><a href="#method.print_and_set_sys_last_vars" title="print_and_set_sys_last_vars">print_and_set_sys_last_vars</a></li><li><a href="#method.restore" title="restore">restore</a></li><li><a href="#method.set_cause" title="set_cause">set_cause</a></li><li><a href="#method.take" title="take">take</a></li><li><a href="#method.traceback" title="traceback">traceback</a></li><li><a href="#method.traceback_bound" title="traceback_bound">traceback_bound</a></li><li><a href="#method.value" title="value">value</a></li><li><a href="#method.value_bound" title="value_bound">value_bound</a></li><li><a href="#method.warn" title="warn">warn</a></li><li><a href="#method.warn_bound" title="warn_bound">warn_bound</a></li><li><a href="#method.warn_explicit" title="warn_explicit">warn_explicit</a></li><li><a href="#method.warn_explicit_bound" title="warn_explicit_bound">warn_explicit_bound</a></li><li><a href="#method.write_unraisable" title="write_unraisable">write_unraisable</a></li><li><a href="#method.write_unraisable_bound" title="write_unraisable_bound">write_unraisable_bound</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-PyErr" title="Debug">Debug</a></li><li><a href="#impl-Display-for-PyErr" title="Display">Display</a></li><li><a href="#impl-Error-for-PyErr" title="Error">Error</a></li><li><a href="#impl-From%3CAddrParseError%3E-for-PyErr" title="From<AddrParseError>">From<AddrParseError></a></li><li><a href="#impl-From%3CBound%3C'py,+T%3E%3E-for-PyErr" title="From<Bound<'py, T>>">From<Bound<'py, T>></a></li><li><a href="#impl-From%3CDecodeUtf16Error%3E-for-PyErr" title="From<DecodeUtf16Error>">From<DecodeUtf16Error></a></li><li><a href="#impl-From%3CDowncastError%3C'_,+'_%3E%3E-for-PyErr" title="From<DowncastError<'_, '_>>">From<DowncastError<'_, '_>></a></li><li><a href="#impl-From%3CDowncastIntoError%3C'_%3E%3E-for-PyErr" title="From<DowncastIntoError<'_>>">From<DowncastIntoError<'_>></a></li><li><a href="#impl-From%3CError%3E-for-PyErr" title="From<Error>">From<Error></a></li><li><a href="#impl-From%3CFromUtf16Error%3E-for-PyErr" title="From<FromUtf16Error>">From<FromUtf16Error></a></li><li><a href="#impl-From%3CFromUtf8Error%3E-for-PyErr" title="From<FromUtf8Error>">From<FromUtf8Error></a></li><li><a href="#impl-From%3CInfallible%3E-for-PyErr" title="From<Infallible>">From<Infallible></a></li><li><a href="#impl-From%3CIntoInnerError%3CW%3E%3E-for-PyErr" title="From<IntoInnerError<W>>">From<IntoInnerError<W>></a></li><li><a href="#impl-From%3CIntoStringError%3E-for-PyErr" title="From<IntoStringError>">From<IntoStringError></a></li><li><a href="#impl-From%3CNulError%3E-for-PyErr" title="From<NulError>">From<NulError></a></li><li><a href="#impl-From%3CParseBoolError%3E-for-PyErr" title="From<ParseBoolError>">From<ParseBoolError></a></li><li><a href="#impl-From%3CParseFloatError%3E-for-PyErr" title="From<ParseFloatError>">From<ParseFloatError></a></li><li><a href="#impl-From%3CParseIntError%3E-for-PyErr" title="From<ParseIntError>">From<ParseIntError></a></li><li><a href="#impl-From%3CPyBorrowError%3E-for-PyErr" title="From<PyBorrowError>">From<PyBorrowError></a></li><li><a href="#impl-From%3CPyBorrowMutError%3E-for-PyErr" title="From<PyBorrowMutError>">From<PyBorrowMutError></a></li><li><a href="#impl-From%3CPyErr%3E-for-Error" title="From<PyErr>">From<PyErr></a></li><li><a href="#impl-From%3CTryFromIntError%3E-for-PyErr" title="From<TryFromIntError>">From<TryFromIntError></a></li><li><a href="#impl-From%3CTryFromSliceError%3E-for-PyErr" title="From<TryFromSliceError>">From<TryFromSliceError></a></li><li><a href="#impl-From%3CUtf8Error%3E-for-PyErr" title="From<Utf8Error>">From<Utf8Error></a></li><li><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyErr" title="IntoPy<Py<PyAny>>">IntoPy<Py<PyAny>></a></li><li><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyErr" title="IntoPy<Py<PyAny>>">IntoPy<Py<PyAny>></a></li><li><a href="#impl-IntoPyObject%3C'py%3E-for-%26PyErr" title="IntoPyObject<'py>">IntoPyObject<'py></a></li><li><a href="#impl-IntoPyObject%3C'py%3E-for-PyErr" title="IntoPyObject<'py>">IntoPyObject<'py></a></li><li><a href="#impl-ToPyObject-for-PyErr" title="ToPyObject">ToPyObject</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-PyErr" title="!Freeze">!Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-PyErr" title="!RefUnwindSafe">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-PyErr" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Send-for-PyErr" title="Send">Send</a></li><li><a href="#impl-Sync-for-PyErr" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-PyErr" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-IntoPyObjectExt%3C'py%3E-for-T" title="IntoPyObjectExt<'py>">IntoPyObjectExt<'py></a></li><li><a href="#impl-PyErrArguments-for-T" title="PyErrArguments">PyErrArguments</a></li><li><a href="#impl-ToString-for-T" title="ToString">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li><li><a href="#impl-Ungil-for-T" title="Ungil">Ungil</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In pyo3::<wbr>prelude</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">pyo3</a>::<wbr><a href="index.html">prelude</a></span><h1>Struct <span class="struct">PyErr</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/pyo3/err/mod.rs.html#35-37">Source</a> </span></div><pre class="rust item-decl"><code>pub struct PyErr { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Represents a Python exception.</p>
|
||
<p>To avoid needing access to <a href="../marker/struct.Python.html" title="struct pyo3::marker::Python"><code>Python</code></a> in <code>Into</code> conversions to create <code>PyErr</code> (thus improving
|
||
compatibility with <code>?</code> and other Rust errors) this type supports creating exceptions instances
|
||
in a lazy fashion, where the full Python object for the exception is created only when needed.</p>
|
||
<p>Accessing the contained exception in any way, such as with <a href="../struct.PyErr.html#method.value_bound" title="method pyo3::PyErr::value_bound"><code>value_bound</code></a>,
|
||
<a href="../struct.PyErr.html#method.get_type_bound" title="method pyo3::PyErr::get_type_bound"><code>get_type_bound</code></a>, or <a href="../struct.PyErr.html#method.is_instance_bound" title="method pyo3::PyErr::is_instance_bound"><code>is_instance_bound</code></a>
|
||
will create the full exception object if it was not already created.</p>
|
||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#118-768">Source</a><a href="#impl-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#171-182">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a><T, A>(args: A) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a><div class="where">where
|
||
T: <a class="trait" href="../type_object/trait.PyTypeInfo.html" title="trait pyo3::type_object::PyTypeInfo">PyTypeInfo</a>,
|
||
A: <a class="trait" href="../trait.PyErrArguments.html" title="trait pyo3::PyErrArguments">PyErrArguments</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Creates a new PyErr of type <code>T</code>.</p>
|
||
<p><code>args</code> can be:</p>
|
||
<ul>
|
||
<li>a tuple: the exception instance will be created using the equivalent to the Python
|
||
expression <code>T(*tuple)</code></li>
|
||
<li>any other value: the exception instance will be created using the equivalent to the Python
|
||
expression <code>T(value)</code></li>
|
||
</ul>
|
||
<p>This exception instance will be initialized lazily. This avoids the need for the Python GIL
|
||
to be held, but requires <code>args</code> to be <code>Send</code> and <code>Sync</code>. If <code>args</code> is not <code>Send</code> or <code>Sync</code>,
|
||
consider using <a href="../struct.PyErr.html#method.from_value_bound" title="associated function pyo3::PyErr::from_value_bound"><code>PyErr::from_value_bound</code></a> instead.</p>
|
||
<p>If <code>T</code> does not inherit from <code>BaseException</code>, then a <code>TypeError</code> will be returned.</p>
|
||
<p>If calling T’s constructor with <code>args</code> raises an exception, that exception will be returned.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">use </span>pyo3::exceptions::PyTypeError;
|
||
|
||
<span class="attr">#[pyfunction]
|
||
</span><span class="kw">fn </span>always_throws() -> PyResult<()> {
|
||
<span class="prelude-val">Err</span>(PyErr::new::<PyTypeError, <span class="kw">_</span>>(<span class="string">"Error message"</span>))
|
||
}</code></pre></div>
|
||
<p>In most cases, you can use a concrete exception’s constructor instead:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">use </span>pyo3::exceptions::PyTypeError;
|
||
|
||
<span class="attr">#[pyfunction]
|
||
</span><span class="kw">fn </span>always_throws() -> PyResult<()> {
|
||
<span class="prelude-val">Err</span>(PyTypeError::new_err(<span class="string">"Error message"</span>))
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_type" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#194-199">Source</a><h4 class="code-header">pub fn <a href="#method.from_type" class="fn">from_type</a><A>(ty: <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>, args: A) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a><div class="where">where
|
||
A: <a class="trait" href="../trait.PyErrArguments.html" title="trait pyo3::PyErrArguments">PyErrArguments</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Constructs a new PyErr from the given Python type and arguments.</p>
|
||
<p><code>ty</code> is the exception type; usually one of the standard exceptions
|
||
like <code>exceptions::PyRuntimeError</code>.</p>
|
||
<p><code>args</code> is either a tuple or a single value, with the same meaning as in <a href="../struct.PyErr.html#method.new" title="associated function pyo3::PyErr::new"><code>PyErr::new</code></a>.</p>
|
||
<p>If <code>ty</code> does not inherit from <code>BaseException</code>, then a <code>TypeError</code> will be returned.</p>
|
||
<p>If calling <code>ty</code> with <code>args</code> raises an exception, that exception will be returned.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_type_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#204-209">Source</a><h4 class="code-header">pub fn <a href="#method.from_type_bound" class="fn">from_type_bound</a><A>(ty: <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>, args: A) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a><div class="where">where
|
||
A: <a class="trait" href="../trait.PyErrArguments.html" title="trait pyo3::PyErrArguments">PyErrArguments</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::from_type</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.from_type" title="associated function pyo3::PyErr::from_type"><code>PyErr::from_type</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_value" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#244-257">Source</a><h4 class="code-header">pub fn <a href="#method.from_value" class="fn">from_value</a>(obj: <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class="docblock"><p>Creates a new PyErr.</p>
|
||
<p>If <code>obj</code> is a Python exception object, the PyErr will contain that object.</p>
|
||
<p>If <code>obj</code> is a Python exception type object, this is equivalent to <code>PyErr::from_type(obj, ())</code>.</p>
|
||
<p>Otherwise, a <code>TypeError</code> is created.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">use </span>pyo3::PyTypeInfo;
|
||
<span class="kw">use </span>pyo3::exceptions::PyTypeError;
|
||
<span class="kw">use </span>pyo3::types::PyString;
|
||
|
||
Python::with_gil(|py| {
|
||
<span class="comment">// Case #1: Exception object
|
||
</span><span class="kw">let </span>err = PyErr::from_value(PyTypeError::new_err(<span class="string">"some type error"</span>)
|
||
.value(py).clone().into_any());
|
||
<span class="macro">assert_eq!</span>(err.to_string(), <span class="string">"TypeError: some type error"</span>);
|
||
|
||
<span class="comment">// Case #2: Exception type
|
||
</span><span class="kw">let </span>err = PyErr::from_value(PyTypeError::type_object(py).into_any());
|
||
<span class="macro">assert_eq!</span>(err.to_string(), <span class="string">"TypeError: "</span>);
|
||
|
||
<span class="comment">// Case #3: Invalid exception value
|
||
</span><span class="kw">let </span>err = PyErr::from_value(PyString::new(py, <span class="string">"foo"</span>).into_any());
|
||
<span class="macro">assert_eq!</span>(
|
||
err.to_string(),
|
||
<span class="string">"TypeError: exceptions must derive from BaseException"
|
||
</span>);
|
||
});</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_value_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#262-264">Source</a><h4 class="code-header">pub fn <a href="#method.from_value_bound" class="fn">from_value_bound</a>(obj: <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::from_value</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.from_value" title="associated function pyo3::PyErr::from_value"><code>PyErr::from_value</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_type" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#277-279">Source</a><h4 class="code-header">pub fn <a href="#method.get_type" class="fn">get_type</a><'py>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>></h4></section></summary><div class="docblock"><p>Returns the type of this exception.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::{prelude::<span class="kw-2">*</span>, exceptions::PyTypeError, types::PyType};
|
||
|
||
Python::with_gil(|py| {
|
||
<span class="kw">let </span>err: PyErr = PyTypeError::new_err((<span class="string">"some type error"</span>,));
|
||
<span class="macro">assert!</span>(err.get_type(py).is(<span class="kw-2">&</span>PyType::new::<PyTypeError>(py)));
|
||
});</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_type_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#284-286">Source</a><h4 class="code-header">pub fn <a href="#method.get_type_bound" class="fn">get_type_bound</a><'py>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::get_type</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.get_type" title="method pyo3::PyErr::get_type"><code>PyErr::get_type</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.value" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#301-303">Source</a><h4 class="code-header">pub fn <a href="#method.value" class="fn">value</a><'py>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../exceptions/struct.PyBaseException.html" title="struct pyo3::exceptions::PyBaseException">PyBaseException</a>></h4></section></summary><div class="docblock"><p>Returns the value of this exception.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::{exceptions::PyTypeError, PyErr, Python};
|
||
|
||
Python::with_gil(|py| {
|
||
<span class="kw">let </span>err: PyErr = PyTypeError::new_err((<span class="string">"some type error"</span>,));
|
||
<span class="macro">assert!</span>(err.is_instance_of::<PyTypeError>(py));
|
||
<span class="macro">assert_eq!</span>(err.value(py).to_string(), <span class="string">"some type error"</span>);
|
||
});</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.value_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#308-310">Source</a><h4 class="code-header">pub fn <a href="#method.value_bound" class="fn">value_bound</a><'py>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../exceptions/struct.PyBaseException.html" title="struct pyo3::exceptions::PyBaseException">PyBaseException</a>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::value</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.value" title="method pyo3::PyErr::value"><code>PyErr::value</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_value" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#313-325">Source</a><h4 class="code-header">pub fn <a href="#method.into_value" class="fn">into_value</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../exceptions/struct.PyBaseException.html" title="struct pyo3::exceptions::PyBaseException">PyBaseException</a>></h4></section></summary><div class="docblock"><p>Consumes self to take ownership of the exception value contained in this error.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.traceback" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#338-340">Source</a><h4 class="code-header">pub fn <a href="#method.traceback" class="fn">traceback</a><'py>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyTraceback.html" title="struct pyo3::types::PyTraceback">PyTraceback</a>>></h4></section></summary><div class="docblock"><p>Returns the traceback of this exception object.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::{exceptions::PyTypeError, Python};
|
||
|
||
Python::with_gil(|py| {
|
||
<span class="kw">let </span>err = PyTypeError::new_err((<span class="string">"some type error"</span>,));
|
||
<span class="macro">assert!</span>(err.traceback(py).is_none());
|
||
});</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.traceback_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#345-347">Source</a><h4 class="code-header">pub fn <a href="#method.traceback_bound" class="fn">traceback_bound</a><'py>(
|
||
&self,
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyTraceback.html" title="struct pyo3::types::PyTraceback">PyTraceback</a>>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::traceback</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.traceback" title="method pyo3::PyErr::traceback"><code>PyErr::traceback</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.occurred" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#351-353">Source</a><h4 class="code-header">pub fn <a href="#method.occurred" class="fn">occurred</a>(_: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Gets whether an error is present in the Python interpreter’s global state.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.take" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#364-376">Source</a><h4 class="code-header">pub fn <a href="#method.take" class="fn">take</a>(py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a>></h4></section></summary><div class="docblock"><p>Takes the current error from the Python interpreter’s global state and clears the global
|
||
state. If no error is set, returns <code>None</code>.</p>
|
||
<p>If the error is a <code>PanicException</code> (which would have originated from a panic in a pyo3
|
||
callback) then this function will resume the panic.</p>
|
||
<p>Use this function when it is not known if an error should be present. If the error is
|
||
expected to have been set, for example from <a href="../struct.PyErr.html#method.occurred" title="associated function pyo3::PyErr::occurred"><code>PyErr::occurred</code></a> or by an error return value
|
||
from a C FFI function, use <a href="../struct.PyErr.html#method.fetch" title="associated function pyo3::PyErr::fetch"><code>PyErr::fetch</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fetch" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#404-413">Source</a><h4 class="code-header">pub fn <a href="#method.fetch" class="fn">fetch</a>(py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class="docblock"><p>Equivalent to <a href="../struct.PyErr.html#method.take" title="associated function pyo3::PyErr::take">PyErr::take</a>, but when no error is set:</p>
|
||
<ul>
|
||
<li>Panics in debug mode.</li>
|
||
<li>Returns a <code>SystemError</code> in release mode.</li>
|
||
</ul>
|
||
<p>This behavior is consistent with Python’s internal handling of what happens when a C return
|
||
value indicates an error occurred but the global error state is empty. (A lack of exception
|
||
should be treated as a bug in the code which returned an error code but did not set an
|
||
exception.)</p>
|
||
<p>Use this function when the error is expected to have been set, for example from
|
||
<a href="../struct.PyErr.html#method.occurred" title="associated function pyo3::PyErr::occurred">PyErr::occurred</a> or by an error return value from a C FFI function.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_type" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#425-450">Source</a><h4 class="code-header">pub fn <a href="#method.new_type" class="fn">new_type</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
name: &<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>,
|
||
doc: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>>,
|
||
base: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>>,
|
||
dict: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a>>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>></h4></section></summary><div class="docblock"><p>Creates a new exception type with the given name and docstring.</p>
|
||
<ul>
|
||
<li><code>base</code> can be an existing exception type to subclass, or a tuple of classes.</li>
|
||
<li><code>dict</code> specifies an optional dictionary of class variables and methods.</li>
|
||
<li><code>doc</code> will be the docstring seen by python users.</li>
|
||
</ul>
|
||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||
<p>This function returns an error if <code>name</code> is not of the form <code><module>.<ExceptionName></code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_type_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#455-473">Source</a><h4 class="code-header">pub fn <a href="#method.new_type_bound" class="fn">new_type_bound</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
name: &<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>,
|
||
doc: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>>,
|
||
base: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>>,
|
||
dict: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a>>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyType.html" title="struct pyo3::types::PyType">PyType</a>>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::new_type</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.new_type" title="associated function pyo3::PyErr::new_type"><code>PyErr::new_type</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.display" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#476-498">Source</a><h4 class="code-header">pub fn <a href="#method.display" class="fn">display</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>)</h4></section></summary><div class="docblock"><p>Prints a standard traceback to <code>sys.stderr</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.print" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#501-504">Source</a><h4 class="code-header">pub fn <a href="#method.print" class="fn">print</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>)</h4></section></summary><div class="docblock"><p>Calls <code>sys.excepthook</code> and then prints a standard traceback to <code>sys.stderr</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.print_and_set_sys_last_vars" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#509-512">Source</a><h4 class="code-header">pub fn <a href="#method.print_and_set_sys_last_vars" class="fn">print_and_set_sys_last_vars</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>)</h4></section></summary><div class="docblock"><p>Calls <code>sys.excepthook</code> and then prints a standard traceback to <code>sys.stderr</code>.</p>
|
||
<p>Additionally sets <code>sys.last_{type,value,traceback,exc}</code> attributes to this exception.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.matches" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#518-523">Source</a><h4 class="code-header">pub fn <a href="#method.matches" class="fn">matches</a><'py, T>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>, exc: T) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a>, T::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Error" title="type pyo3::conversion::IntoPyObject::Error">Error</a>><div class="where">where
|
||
T: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py>,</div></h4></section></summary><div class="docblock"><p>Returns true if the current exception matches the exception in <code>exc</code>.</p>
|
||
<p>If <code>exc</code> is a class object, this also returns <code>true</code> when <code>self</code> is an instance of a subclass.
|
||
If <code>exc</code> is a tuple, all exceptions in the tuple (and recursively in subtuples) are searched for a match.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_instance" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#527-530">Source</a><h4 class="code-header">pub fn <a href="#method.is_instance" class="fn">is_instance</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>, ty: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if the current exception is instance of <code>T</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_instance_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#535-537">Source</a><h4 class="code-header">pub fn <a href="#method.is_instance_bound" class="fn">is_instance_bound</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>, ty: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::is_instance</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.is_instance" title="method pyo3::PyErr::is_instance"><code>PyErr::is_instance</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_instance_of" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#541-546">Source</a><h4 class="code-header">pub fn <a href="#method.is_instance_of" class="fn">is_instance_of</a><T>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a><div class="where">where
|
||
T: <a class="trait" href="../type_object/trait.PyTypeInfo.html" title="trait pyo3::type_object::PyTypeInfo">PyTypeInfo</a>,</div></h4></section></summary><div class="docblock"><p>Returns true if the current exception is instance of <code>T</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.restore" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#551-553">Source</a><h4 class="code-header">pub fn <a href="#method.restore" class="fn">restore</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>)</h4></section></summary><div class="docblock"><p>Writes the error back to the Python interpreter’s global state.
|
||
This is the opposite of <code>PyErr::fetch()</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_unraisable" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#584-587">Source</a><h4 class="code-header">pub fn <a href="#method.write_unraisable" class="fn">write_unraisable</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>, obj: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>>)</h4></section></summary><div class="docblock"><p>Reports the error as unraisable.</p>
|
||
<p>This calls <code>sys.unraisablehook()</code> using the current exception and obj argument.</p>
|
||
<p>This method is useful to report errors in situations where there is no good mechanism
|
||
to report back to the Python land. In Python this is used to indicate errors in
|
||
background threads or destructors which are protected. In Rust code this is commonly
|
||
useful when you are calling into a Python callback which might fail, but there is no
|
||
obvious way to handle this error other than logging it.</p>
|
||
<p>Calling this method has the benefit that the error goes back into a standardized callback
|
||
in Python which for instance allows unittests to ensure that no unraisable error
|
||
actually happend by hooking <code>sys.unraisablehook</code>.</p>
|
||
<p>Example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Python::with_gil(|py| {
|
||
<span class="kw">match </span>failing_function() {
|
||
<span class="prelude-val">Err</span>(pyerr) => pyerr.write_unraisable(py, <span class="prelude-val">None</span>),
|
||
<span class="prelude-val">Ok</span>(..) => { <span class="comment">/* do something here */ </span>}
|
||
}
|
||
<span class="prelude-val">Ok</span>(())
|
||
})</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.write_unraisable_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#592-594">Source</a><h4 class="code-header">pub fn <a href="#method.write_unraisable_bound" class="fn">write_unraisable_bound</a>(
|
||
self,
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>,
|
||
obj: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'_, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>>,
|
||
)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::write_unraisable</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.write_unraisable" title="method pyo3::PyErr::write_unraisable"><code>PyErr::write_unraisable</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.warn" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#618-631">Source</a><h4 class="code-header">pub fn <a href="#method.warn" class="fn">warn</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
category: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>,
|
||
message: &<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>,
|
||
stacklevel: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.i32.html">i32</a>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Issues a warning message.</p>
|
||
<p>May return an <code>Err(PyErr)</code> if warnings-as-errors is enabled.</p>
|
||
<p>Equivalent to <code>warnings.warn()</code> in Python.</p>
|
||
<p>The <code>category</code> should be one of the <code>Warning</code> classes available in
|
||
<a href="../exceptions/index.html" title="mod pyo3::exceptions"><code>pyo3::exceptions</code></a>, or a subclass. The Python
|
||
object can be retrieved using <a href="../marker/struct.Python.html#method.get_type_bound" title="method pyo3::marker::Python::get_type_bound"><code>Python::get_type_bound()</code></a>.</p>
|
||
<p>Example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Python::with_gil(|py| {
|
||
<span class="kw">let </span>user_warning = py.get_type::<pyo3::exceptions::PyUserWarning>();
|
||
PyErr::warn(py, <span class="kw-2">&</span>user_warning, <span class="macro">c_str!</span>(<span class="string">"I am warning you"</span>), <span class="number">0</span>)<span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
})</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.warn_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#636-644">Source</a><h4 class="code-header">pub fn <a href="#method.warn_bound" class="fn">warn_bound</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
category: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>,
|
||
message: &<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>,
|
||
stacklevel: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.i32.html">i32</a>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.unit.html">()</a>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::warn</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.warn" title="associated function pyo3::PyErr::warn"><code>PyErr::warn</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.warn_explicit" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#654-681">Source</a><h4 class="code-header">pub fn <a href="#method.warn_explicit" class="fn">warn_explicit</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
category: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>,
|
||
message: &<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>,
|
||
filename: &<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>,
|
||
lineno: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.i32.html">i32</a>,
|
||
module: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/ffi/c_str/struct.CStr.html" title="struct core::ffi::c_str::CStr">CStr</a>>,
|
||
registry: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Issues a warning message, with more control over the warning attributes.</p>
|
||
<p>May return a <code>PyErr</code> if warnings-as-errors is enabled.</p>
|
||
<p>Equivalent to <code>warnings.warn_explicit()</code> in Python.</p>
|
||
<p>The <code>category</code> should be one of the <code>Warning</code> classes available in
|
||
<a href="../exceptions/index.html" title="mod pyo3::exceptions"><code>pyo3::exceptions</code></a>, or a subclass.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.warn_explicit_bound" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#686-707">Source</a><h4 class="code-header">pub fn <a href="#method.warn_explicit_bound" class="fn">warn_explicit_bound</a><'py>(
|
||
py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>,
|
||
category: &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>,
|
||
message: &<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>,
|
||
filename: &<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>,
|
||
lineno: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.i32.html">i32</a>,
|
||
module: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>>,
|
||
registry: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>>,
|
||
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.unit.html">()</a>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: renamed to <code>PyErr::warn</code></span></div></span></summary><div class="docblock"><p>Deprecated name for <a href="../struct.PyErr.html#method.warn_explicit" title="associated function pyo3::PyErr::warn_explicit"><code>PyErr::warn_explicit</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clone_ref" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#726-728">Source</a><h4 class="code-header">pub fn <a href="#method.clone_ref" class="fn">clone_ref</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class="docblock"><p>Clone the PyErr. This requires the GIL, which is why PyErr does not implement Clone.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::{exceptions::PyTypeError, PyErr, Python, prelude::PyAnyMethods};
|
||
Python::with_gil(|py| {
|
||
<span class="kw">let </span>err: PyErr = PyTypeError::new_err((<span class="string">"some type error"</span>,));
|
||
<span class="kw">let </span>err_clone = err.clone_ref(py);
|
||
<span class="macro">assert!</span>(err.get_type(py).is(<span class="kw-2">&</span>err_clone.get_type(py)));
|
||
<span class="macro">assert!</span>(err.value(py).is(err_clone.value(py)));
|
||
<span class="kw">match </span>err.traceback(py) {
|
||
<span class="prelude-val">None </span>=> <span class="macro">assert!</span>(err_clone.traceback(py).is_none()),
|
||
<span class="prelude-val">Some</span>(tb) => <span class="macro">assert!</span>(err_clone.traceback(py).unwrap().is(<span class="kw-2">&</span>tb)),
|
||
}
|
||
});</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.cause" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#732-744">Source</a><h4 class="code-header">pub fn <a href="#method.cause" class="fn">cause</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a>></h4></section></summary><div class="docblock"><p>Return the cause (either an exception instance, or None, set by <code>raise ... from ...</code>)
|
||
associated with the exception, as accessible from Python through <code>__cause__</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_cause" class="method"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#747-757">Source</a><h4 class="code-header">pub fn <a href="#method.set_cause" class="fn">set_cause</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>, cause: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self>)</h4></section></summary><div class="docblock"><p>Set the cause associated with the exception, pass <code>None</code> to clear it.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#770-793">Source</a><a href="#impl-Debug-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#771-792">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#795-808">Source</a><a href="#impl-Display-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#796-807">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.85.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Error-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#810">Source</a><a href="#impl-Error-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.source" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.1/src/core/error.rs.html#81">Source</a></span><a href="#method.source" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.source" class="fn">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> + 'static)></h4></section></summary><div class='docblock'>Returns the lower-level source of this error, if any. <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.source">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.description" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.1/src/core/error.rs.html#107">Source</a></span><a href="#method.description" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.description" class="fn">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.42.0: use the Display impl or to_string()</span></div></span><div class='docblock'> <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.description">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.cause-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.1/src/core/error.rs.html#117">Source</a></span><a href="#method.cause-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.cause" class="fn">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a>></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.33.0: replaced by Error::source, which can support downcasting</span></div></span></details><details class="toggle method-toggle" open><summary><section id="method.provide" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/error.rs.html#180">Source</a><a href="#method.provide" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.provide" class="fn">provide</a><'a>(&'a self, request: &mut <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/error/struct.Request.html" title="struct core::error::Request">Request</a><'a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>error_generic_member_access</code>)</span></div></span><div class='docblock'>Provides type-based access to context intended for error reports. <a href="https://doc.rust-lang.org/1.85.1/core/error/trait.Error.html#method.provide">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CAddrParseError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#142">Source</a><a href="#impl-From%3CAddrParseError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/net/parser/struct.AddrParseError.html" title="struct core::net::parser::AddrParseError">AddrParseError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-15" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#142">Source</a><a href="#method.from-15" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/net/parser/struct.AddrParseError.html" title="struct core::net::parser::AddrParseError">AddrParseError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBound%3C'py,+T%3E%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#887-895">Source</a><a href="#impl-From%3CBound%3C'py,+T%3E%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl<'py, T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, T>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a><div class="where">where
|
||
T: <a class="trait" href="../trait.ToPyErr.html" title="trait pyo3::ToPyErr">ToPyErr</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-16" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#892-894">Source</a><a href="#method.from-16" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, T>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDecodeUtf16Error%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#138-141">Source</a><a href="#impl-From%3CDecodeUtf16Error%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/char/decode/struct.DecodeUtf16Error.html" title="struct core::char::decode::DecodeUtf16Error">DecodeUtf16Error</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-14" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#138-141">Source</a><a href="#method.from-14" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/char/decode/struct.DecodeUtf16Error.html" title="struct core::char::decode::DecodeUtf16Error">DecodeUtf16Error</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDowncastError%3C'_,+'_%3E%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#898-907">Source</a><a href="#impl-From%3CDowncastError%3C'_,+'_%3E%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../struct.DowncastError.html" title="struct pyo3::DowncastError">DowncastError</a><'_, '_>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3><div class="docblock"><p>Convert <code>DowncastError</code> to Python <code>TypeError</code>.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-17" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#899-906">Source</a><a href="#method.from-17" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="../struct.DowncastError.html" title="struct pyo3::DowncastError">DowncastError</a><'_, '_>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDowncastIntoError%3C'_%3E%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#918-927">Source</a><a href="#impl-From%3CDowncastIntoError%3C'_%3E%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../struct.DowncastIntoError.html" title="struct pyo3::DowncastIntoError">DowncastIntoError</a><'_>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3><div class="docblock"><p>Convert <code>DowncastIntoError</code> to Python <code>TypeError</code>.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-18" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#919-926">Source</a><a href="#method.from-18" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="../struct.DowncastIntoError.html" title="struct pyo3::DowncastIntoError">DowncastIntoError</a><'_>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#49-73">Source</a><a href="#impl-From%3CError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3><div class="docblock"><p>Create <code>PyErr</code> from <code>io::Error</code>
|
||
(<code>OSError</code> except if the <code>io::Error</code> is wrapping a Python exception,
|
||
in this case the exception is returned)</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#50-72">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CFromUtf16Error%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#134-137">Source</a><a href="#impl-From%3CFromUtf16Error%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/string/struct.FromUtf16Error.html" title="struct alloc::string::FromUtf16Error">FromUtf16Error</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-13" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#134-137">Source</a><a href="#method.from-13" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/string/struct.FromUtf16Error.html" title="struct alloc::string::FromUtf16Error">FromUtf16Error</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CFromUtf8Error%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#133">Source</a><a href="#impl-From%3CFromUtf8Error%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/string/struct.FromUtf8Error.html" title="struct alloc::string::FromUtf8Error">FromUtf8Error</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-12" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#133">Source</a><a href="#method.from-12" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/string/struct.FromUtf8Error.html" title="struct alloc::string::FromUtf8Error">FromUtf8Error</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CInfallible%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#98-102">Source</a><a href="#impl-From%3CInfallible%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="enum" href="https://doc.rust-lang.org/1.85.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#99-101">Source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(_: <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CIntoInnerError%3CW%3E%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#86-90">Source</a><a href="#impl-From%3CIntoInnerError%3CW%3E%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl<W> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/std/io/buffered/struct.IntoInnerError.html" title="struct std::io::buffered::IntoInnerError">IntoInnerError</a><W>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#87-89">Source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/std/io/buffered/struct.IntoInnerError.html" title="struct std::io::buffered::IntoInnerError">IntoInnerError</a><W>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CIntoStringError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#130">Source</a><a href="#impl-From%3CIntoStringError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/ffi/c_str/struct.IntoStringError.html" title="struct alloc::ffi::c_str::IntoStringError">IntoStringError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-9" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#130">Source</a><a href="#method.from-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/ffi/c_str/struct.IntoStringError.html" title="struct alloc::ffi::c_str::IntoStringError">IntoStringError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CNulError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#131">Source</a><a href="#impl-From%3CNulError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/ffi/c_str/struct.NulError.html" title="struct alloc::ffi::c_str::NulError">NulError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-10" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#131">Source</a><a href="#method.from-10" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/ffi/c_str/struct.NulError.html" title="struct alloc::ffi::c_str::NulError">NulError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CParseBoolError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#129">Source</a><a href="#impl-From%3CParseBoolError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/str/error/struct.ParseBoolError.html" title="struct core::str::error::ParseBoolError">ParseBoolError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-8" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#129">Source</a><a href="#method.from-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/str/error/struct.ParseBoolError.html" title="struct core::str::error::ParseBoolError">ParseBoolError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CParseFloatError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#127">Source</a><a href="#impl-From%3CParseFloatError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/dec2flt/struct.ParseFloatError.html" title="struct core::num::dec2flt::ParseFloatError">ParseFloatError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-6" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#127">Source</a><a href="#method.from-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/dec2flt/struct.ParseFloatError.html" title="struct core::num::dec2flt::ParseFloatError">ParseFloatError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CParseIntError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#126">Source</a><a href="#impl-From%3CParseIntError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/error/struct.ParseIntError.html" title="struct core::num::error::ParseIntError">ParseIntError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-5" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#126">Source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/error/struct.ParseIntError.html" title="struct core::num::error::ParseIntError">ParseIntError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CPyBorrowError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#702-706">Source</a><a href="#impl-From%3CPyBorrowError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../pycell/struct.PyBorrowError.html" title="struct pyo3::pycell::PyBorrowError">PyBorrowError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-19" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#703-705">Source</a><a href="#method.from-19" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(other: <a class="struct" href="../pycell/struct.PyBorrowError.html" title="struct pyo3::pycell::PyBorrowError">PyBorrowError</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CPyBorrowMutError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#727-731">Source</a><a href="#impl-From%3CPyBorrowMutError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../pycell/struct.PyBorrowMutError.html" title="struct pyo3::pycell::PyBorrowMutError">PyBorrowMutError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-20" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/pycell.rs.html#728-730">Source</a><a href="#method.from-20" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(other: <a class="struct" href="../pycell/struct.PyBorrowMutError.html" title="struct pyo3::pycell::PyBorrowMutError">PyBorrowMutError</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CPyErr%3E-for-Error" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#6-44">Source</a><a href="#impl-From%3CPyErr%3E-for-Error" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a>> for <a class="struct" href="https://doc.rust-lang.org/1.85.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h3><div class="docblock"><p>Convert <code>PyErr</code> to <code>io::Error</code></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#7-43">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CTryFromIntError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#128">Source</a><a href="#impl-From%3CTryFromIntError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/error/struct.TryFromIntError.html" title="struct core::num::error::TryFromIntError">TryFromIntError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-7" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#128">Source</a><a href="#method.from-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/num/error/struct.TryFromIntError.html" title="struct core::num::error::TryFromIntError">TryFromIntError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CTryFromSliceError%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#125">Source</a><a href="#impl-From%3CTryFromSliceError%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/array/struct.TryFromSliceError.html" title="struct core::array::TryFromSliceError">TryFromSliceError</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#125">Source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/array/struct.TryFromSliceError.html" title="struct core::array::TryFromSliceError">TryFromSliceError</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CUtf8Error%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#132">Source</a><a href="#impl-From%3CUtf8Error%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.1/core/str/error/struct.Utf8Error.html" title="struct core::str::error::Utf8Error">Utf8Error</a>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-11" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/impls.rs.html#132">Source</a><a href="#method.from-11" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/str/error/struct.Utf8Error.html" title="struct core::str::error::Utf8Error">Utf8Error</a>) -> <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#829-834">Source</a><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-%26PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../conversion/trait.IntoPy.html" title="trait pyo3::conversion::IntoPy">IntoPy</a><<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>> for &<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_py-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#831-833">Source</a><a href="#method.into_py-1" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPy.html#tymethod.into_py" class="fn">into_py</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: <code>IntoPy</code> is going to be replaced by <code>IntoPyObject</code>. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.</span></div></span><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#813-818">Source</a><a href="#impl-IntoPy%3CPy%3CPyAny%3E%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../conversion/trait.IntoPy.html" title="trait pyo3::conversion::IntoPy">IntoPy</a><<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_py" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#815-817">Source</a><a href="#method.into_py" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPy.html#tymethod.into_py" class="fn">into_py</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: <code>IntoPy</code> is going to be replaced by <code>IntoPyObject</code>. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.</span></div></span><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPyObject%3C'py%3E-for-%26PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#847-856">Source</a><a href="#impl-IntoPyObject%3C'py%3E-for-%26PyErr" class="anchor">§</a><h3 class="code-header">impl<'py> <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py> for &<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#848">Source</a><a href="#associatedtype.Target-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Target" class="associatedtype">Target</a> = <a class="struct" href="../exceptions/struct.PyBaseException.html" title="struct pyo3::exceptions::PyBaseException">PyBaseException</a></h4></section></summary><div class='docblock'>The Python output type</div></details><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#849">Source</a><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <&<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a> as <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py>>::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Target" title="type pyo3::conversion::IntoPyObject::Target">Target</a>></h4></section></summary><div class='docblock'>The smart pointer type to use. <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#850">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_pyobject-1" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#853-855">Source</a><a href="#method.into_pyobject-1" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObject.html#tymethod.into_pyobject" class="fn">into_pyobject</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>, Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Error" title="type pyo3::conversion::IntoPyObject::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoPyObject%3C'py%3E-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#836-845">Source</a><a href="#impl-IntoPyObject%3C'py%3E-for-PyErr" class="anchor">§</a><h3 class="code-header">impl<'py> <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#837">Source</a><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Target" class="associatedtype">Target</a> = <a class="struct" href="../exceptions/struct.PyBaseException.html" title="struct pyo3::exceptions::PyBaseException">PyBaseException</a></h4></section></summary><div class='docblock'>The Python output type</div></details><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#838">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <<a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a> as <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py>>::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Target" title="type pyo3::conversion::IntoPyObject::Target">Target</a>></h4></section></summary><div class='docblock'>The smart pointer type to use. <a href="../conversion/trait.IntoPyObject.html#associatedtype.Output">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#839">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="../conversion/trait.IntoPyObject.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_pyobject" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#842-844">Source</a><a href="#method.into_pyobject" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObject.html#tymethod.into_pyobject" class="fn">into_pyobject</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>, Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Error" title="type pyo3::conversion::IntoPyObject::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ToPyObject-for-PyErr" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#821-826">Source</a><a href="#impl-ToPyObject-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../conversion/trait.ToPyObject.html" title="trait pyo3::conversion::ToPyObject">ToPyObject</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_object" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#823-825">Source</a><a href="#method.to_object" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.ToPyObject.html#tymethod.to_object" class="fn">to_object</a>(&self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="type" href="../type.PyObject.html" title="type pyo3::PyObject">PyObject</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.23.0: <code>ToPyObject</code> is going to be replaced by <code>IntoPyObject</code>. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.</span></div></span><div class='docblock'>Converts self into a Python object.</div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-PyErr" class="impl"><a href="#impl-Freeze-for-PyErr" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section><section id="impl-RefUnwindSafe-for-PyErr" class="impl"><a href="#impl-RefUnwindSafe-for-PyErr" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section><section id="impl-Send-for-PyErr" class="impl"><a href="#impl-Send-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section><section id="impl-Sync-for-PyErr" class="impl"><a href="#impl-Sync-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section><section id="impl-Unpin-for-PyErr" class="impl"><a href="#impl-Unpin-for-PyErr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section><section id="impl-UnwindSafe-for-PyErr" class="impl"><a href="#impl-UnwindSafe-for-PyErr" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../struct.PyErr.html" title="struct pyo3::PyErr">PyErr</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.85.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.85.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#767">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-21" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#770">Source</a><a href="#method.from-21" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#750-752">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#760">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoPyObjectExt%3C'py%3E-for-T" class="impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#401">Source</a><a href="#impl-IntoPyObjectExt%3C'py%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<'py, T> <a class="trait" href="../conversion/trait.IntoPyObjectExt.html" title="trait pyo3::conversion::IntoPyObjectExt">IntoPyObjectExt</a><'py> for T<div class="where">where
|
||
T: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_bound_py_any" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#370-375">Source</a><a href="#method.into_bound_py_any" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_bound_py_any" class="fn">into_bound_py_any</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>></h4></section></summary><div class='docblock'>Converts <code>self</code> into an owned Python object, dropping type information.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_py_any" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#380-385">Source</a><a href="#method.into_py_any" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_py_any" class="fn">into_py_any</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>></h4></section></summary><div class='docblock'>Converts <code>self</code> into an owned Python object, dropping type information and unbinding it
|
||
from the <code>'py</code> lifetime.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_pyobject_or_pyerr" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/conversion.rs.html#393-398">Source</a><a href="#method.into_pyobject_or_pyerr" class="anchor">§</a><h4 class="code-header">fn <a href="../conversion/trait.IntoPyObjectExt.html#method.into_pyobject_or_pyerr" class="fn">into_pyobject_or_pyerr</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'py>) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><Self::<a class="associatedtype" href="../conversion/trait.IntoPyObject.html#associatedtype.Output" title="type pyo3::conversion::IntoPyObject::Output">Output</a>></h4></section></summary><div class='docblock'>Converts <code>self</code> into a Python object. <a href="../conversion/trait.IntoPyObjectExt.html#method.into_pyobject_or_pyerr">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-PyErrArguments-for-T" class="impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#105-116">Source</a><a href="#impl-PyErrArguments-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../trait.PyErrArguments.html" title="trait pyo3::PyErrArguments">PyErrArguments</a> for T<div class="where">where
|
||
T: for<'py> <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.arguments" class="method trait-impl"><a class="src rightside" href="../../src/pyo3/err/mod.rs.html#109-115">Source</a><a href="#method.arguments" class="anchor">§</a><h4 class="code-header">fn <a href="../trait.PyErrArguments.html#tymethod.arguments" class="fn">arguments</a>(self, py: <a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a><'_>) -> <a class="struct" href="../struct.Py.html" title="struct pyo3::Py">Py</a><<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>></h4></section></summary><div class='docblock'>Arguments for exception</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/alloc/string.rs.html#2677">Source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.1/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/alloc/string.rs.html#2679">Source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.85.1/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#807-809">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#811">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#814">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#792-794">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#796">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.1/src/core/convert/mod.rs.html#799">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-Ungil-for-T" class="impl"><a class="src rightside" href="../../src/pyo3/marker.rs.html#194">Source</a><a href="#impl-Ungil-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../marker/trait.Ungil.html" title="trait pyo3::marker::Ungil">Ungil</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section></div></section></div></main></body></html> |