74 lines
26 KiB
HTML
74 lines
26 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="Implementation of functionality for `PyTuple`."><title>PyTupleMethods 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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../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="#">PyTuple<wbr>Methods</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_sequence" title="as_sequence">as_sequence</a></li><li><a href="#tymethod.as_slice" title="as_slice">as_slice</a></li><li><a href="#tymethod.contains" title="contains">contains</a></li><li><a href="#tymethod.get_borrowed_item" title="get_borrowed_item">get_borrowed_item</a></li><li><a href="#tymethod.get_borrowed_item_unchecked" title="get_borrowed_item_unchecked">get_borrowed_item_unchecked</a></li><li><a href="#tymethod.get_item" title="get_item">get_item</a></li><li><a href="#tymethod.get_item_unchecked" title="get_item_unchecked">get_item_unchecked</a></li><li><a href="#tymethod.get_slice" title="get_slice">get_slice</a></li><li><a href="#tymethod.index" title="index">index</a></li><li><a href="#tymethod.into_sequence" title="into_sequence">into_sequence</a></li><li><a href="#tymethod.is_empty" title="is_empty">is_empty</a></li><li><a href="#tymethod.iter" title="iter">iter</a></li><li><a href="#tymethod.iter_borrowed" title="iter_borrowed">iter_borrowed</a></li><li><a href="#tymethod.len" title="len">len</a></li><li><a href="#tymethod.to_list" title="to_list">to_list</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><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>Trait <span class="trait">PyTupleMethods</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/types/tuple.rs.html#146-231">Source</a> </span></div><pre class="rust item-decl"><code>pub trait PyTupleMethods<'py>: Sealed {
|
|
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 15 methods</span></summary> // Required methods
|
|
fn <a href="#tymethod.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.bool.html">bool</a>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.as_sequence" class="fn">as_sequence</a>(&self) -> &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PySequence.html" title="struct pyo3::types::PySequence">PySequence</a>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.into_sequence" class="fn">into_sequence</a>(self) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PySequence.html" title="struct pyo3::types::PySequence">PySequence</a>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.get_slice" class="fn">get_slice</a>(&self, low: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>, high: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyTuple.html" title="struct pyo3::types::PyTuple">PyTuple</a>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.get_item" class="fn">get_item</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>) -> <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>>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.get_borrowed_item" class="fn">get_borrowed_item</a><'a>(
|
|
&'a self,
|
|
index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>,
|
|
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a><'a, 'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>>;
|
|
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.get_item_unchecked" class="fn">get_item_unchecked</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</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>>;
|
|
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.get_borrowed_item_unchecked" class="fn">get_borrowed_item_unchecked</a><'a>(
|
|
&'a self,
|
|
index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>,
|
|
) -> <a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a><'a, 'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.as_slice" class="fn">as_slice</a>(&self) -> &[<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>>];
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.contains" class="fn">contains</a><V>(&self, value: V) -> <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.bool.html">bool</a>>
|
|
<span class="where">where V: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py></span>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.index" class="fn">index</a><V>(&self, value: V) -> <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.usize.html">usize</a>>
|
|
<span class="where">where V: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py></span>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.iter" class="fn">iter</a>(&self) -> <a class="struct" href="../types/iter/struct.BoundTupleIterator.html" title="struct pyo3::types::iter::BoundTupleIterator">BoundTupleIterator</a><'py> <a href="#" class="tooltip" data-notable-ty="BoundTupleIterator<'py>">ⓘ</a>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.iter_borrowed" class="fn">iter_borrowed</a><'a>(&'a self) -> <a class="struct" href="../types/iter/struct.BorrowedTupleIterator.html" title="struct pyo3::types::iter::BorrowedTupleIterator">BorrowedTupleIterator</a><'a, 'py> <a href="#" class="tooltip" data-notable-ty="BorrowedTupleIterator<'a, 'py>">ⓘ</a>;
|
|
<span class="item-spacer"></span> fn <a href="#tymethod.to_list" class="fn">to_list</a>(&self) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyList.html" title="struct pyo3::types::PyList">PyList</a>>;
|
|
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implementation of functionality for <a href="../types/struct.PyTuple.html" title="struct pyo3::types::PyTuple"><code>PyTuple</code></a>.</p>
|
|
<p>These methods are defined for the <code>Bound<'py, PyTuple></code> smart pointer, so to use method call
|
|
syntax these methods are separated into a trait, because stable Rust does not yet support
|
|
<code>arbitrary_self_types</code>.</p>
|
|
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.len" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#148">Source</a><h4 class="code-header">fn <a href="#tymethod.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Gets the length of the tuple.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.is_empty" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#151">Source</a><h4 class="code-header">fn <a href="#tymethod.is_empty" class="fn">is_empty</a>(&self) -> <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>Checks if the tuple is empty.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.as_sequence" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#154">Source</a><h4 class="code-header">fn <a href="#tymethod.as_sequence" class="fn">as_sequence</a>(&self) -> &<a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PySequence.html" title="struct pyo3::types::PySequence">PySequence</a>></h4></section></summary><div class="docblock"><p>Returns <code>self</code> cast as a <code>PySequence</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.into_sequence" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#157">Source</a><h4 class="code-header">fn <a href="#tymethod.into_sequence" class="fn">into_sequence</a>(self) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PySequence.html" title="struct pyo3::types::PySequence">PySequence</a>></h4></section></summary><div class="docblock"><p>Returns <code>self</code> cast as a <code>PySequence</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_slice" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#163">Source</a><h4 class="code-header">fn <a href="#tymethod.get_slice" class="fn">get_slice</a>(&self, low: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>, high: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyTuple.html" title="struct pyo3::types::PyTuple">PyTuple</a>></h4></section></summary><div class="docblock"><p>Takes the slice <code>self[low:high]</code> and returns it as a new tuple.</p>
|
|
<p>Indices must be nonnegative, and out-of-range indices are clipped to
|
|
<code>self.len()</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_item" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#179">Source</a><h4 class="code-header">fn <a href="#tymethod.get_item" class="fn">get_item</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>) -> <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"><p>Gets the tuple item at the specified index.</p>
|
|
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::prelude::<span class="kw-2">*</span>;
|
|
|
|
Python::with_gil(|py| -> PyResult<()> {
|
|
<span class="kw">let </span>tuple = (<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>).into_pyobject(py)<span class="question-mark">?</span>;
|
|
<span class="kw">let </span>obj = tuple.get_item(<span class="number">0</span>);
|
|
<span class="macro">assert_eq!</span>(obj<span class="question-mark">?</span>.extract::<i32>()<span class="question-mark">?</span>, <span class="number">1</span>);
|
|
<span class="prelude-val">Ok</span>(())
|
|
})</code></pre></div>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_borrowed_item" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#183">Source</a><h4 class="code-header">fn <a href="#tymethod.get_borrowed_item" class="fn">get_borrowed_item</a><'a>(
|
|
&'a self,
|
|
index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>,
|
|
) -> <a class="type" href="../type.PyResult.html" title="type pyo3::PyResult">PyResult</a><<a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a><'a, 'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>>></h4></section></summary><div class="docblock"><p>Like <a href="../types/trait.PyTupleMethods.html#tymethod.get_item" title="method pyo3::types::PyTupleMethods::get_item"><code>get_item</code></a>, but returns a borrowed object, which is a slight performance optimization
|
|
by avoiding a reference count change.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_item_unchecked" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#191">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.get_item_unchecked" class="fn">get_item_unchecked</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</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"><p>Gets the tuple item at the specified index. Undefined behavior on bad index. Use with caution.</p>
|
|
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
|
|
<p>Caller must verify that the index is within the bounds of the tuple.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_borrowed_item_unchecked" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#200">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.get_borrowed_item_unchecked" class="fn">get_borrowed_item_unchecked</a><'a>(
|
|
&'a self,
|
|
index: <a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.usize.html">usize</a>,
|
|
) -> <a class="struct" href="../struct.Borrowed.html" title="struct pyo3::Borrowed">Borrowed</a><'a, 'py, <a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>></h4></section></summary><div class="docblock"><p>Like <a href="../types/trait.PyTupleMethods.html#tymethod.get_item_unchecked" title="method pyo3::types::PyTupleMethods::get_item_unchecked"><code>get_item_unchecked</code></a>, but returns a borrowed object,
|
|
which is a slight performance optimization by avoiding a reference count change.</p>
|
|
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
|
|
<p>Caller must verify that the index is within the bounds of the tuple.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.as_slice" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#204">Source</a><h4 class="code-header">fn <a href="#tymethod.as_slice" class="fn">as_slice</a>(&self) -> &[<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"><p>Returns <code>self</code> as a slice of objects.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.contains" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#209-211">Source</a><h4 class="code-header">fn <a href="#tymethod.contains" class="fn">contains</a><V>(&self, value: V) -> <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.bool.html">bool</a>><div class="where">where
|
|
V: <a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a><'py>,</div></h4></section></summary><div class="docblock"><p>Determines if self contains <code>value</code>.</p>
|
|
<p>This is equivalent to the Python expression <code>value in self</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.index" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#216-218">Source</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a><V>(&self, value: V) -> <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.usize.html">usize</a>><div class="where">where
|
|
V: <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 the first index <code>i</code> for which <code>self[i] == value</code>.</p>
|
|
<p>This is equivalent to the Python expression <code>self.index(value)</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.iter" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#221">Source</a><h4 class="code-header">fn <a href="#tymethod.iter" class="fn">iter</a>(&self) -> <a class="struct" href="../types/iter/struct.BoundTupleIterator.html" title="struct pyo3::types::iter::BoundTupleIterator">BoundTupleIterator</a><'py> <a href="#" class="tooltip" data-notable-ty="BoundTupleIterator<'py>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over the tuple items.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.iter_borrowed" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#225">Source</a><h4 class="code-header">fn <a href="#tymethod.iter_borrowed" class="fn">iter_borrowed</a><'a>(&'a self) -> <a class="struct" href="../types/iter/struct.BorrowedTupleIterator.html" title="struct pyo3::types::iter::BorrowedTupleIterator">BorrowedTupleIterator</a><'a, 'py> <a href="#" class="tooltip" data-notable-ty="BorrowedTupleIterator<'a, 'py>">ⓘ</a></h4></section></summary><div class="docblock"><p>Like <a href="../types/trait.PyTupleMethods.html#tymethod.iter" title="method pyo3::types::PyTupleMethods::iter"><code>iter</code></a>, but produces an iterator which returns borrowed objects,
|
|
which is a slight performance optimization by avoiding a reference count change.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.to_list" class="method"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#230">Source</a><h4 class="code-header">fn <a href="#tymethod.to_list" class="fn">to_list</a>(&self) -> <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyList.html" title="struct pyo3::types::PyList">PyList</a>></h4></section></summary><div class="docblock"><p>Return a new list containing the contents of this tuple; equivalent to the Python expression <code>list(tuple)</code>.</p>
|
|
<p>This method is equivalent to <code>self.as_sequence().to_list()</code> and faster than <code>PyList::new(py, self)</code>.</p>
|
|
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.85.1/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-PyTupleMethods%3C'py%3E-for-Bound%3C'py,+PyTuple%3E" class="impl"><a class="src rightside" href="../../src/pyo3/types/tuple.rs.html#233-320">Source</a><a href="#impl-PyTupleMethods%3C'py%3E-for-Bound%3C'py,+PyTuple%3E" class="anchor">§</a><h3 class="code-header">impl<'py> <a class="trait" href="../types/trait.PyTupleMethods.html" title="trait pyo3::types::PyTupleMethods">PyTupleMethods</a><'py> for <a class="struct" href="../struct.Bound.html" title="struct pyo3::Bound">Bound</a><'py, <a class="struct" href="../types/struct.PyTuple.html" title="struct pyo3::types::PyTuple">PyTuple</a>></h3></section></div><script src="../../trait.impl/pyo3/types/tuple/trait.PyTupleMethods.js" async></script><script type="text/json" id="notable-traits-data">{"BorrowedTupleIterator<'a, 'py>":"<h3>Notable traits for <code><a class=\"struct\" href=\"../types/iter/struct.BorrowedTupleIterator.html\" title=\"struct pyo3::types::iter::BorrowedTupleIterator\">BorrowedTupleIterator</a><'a, 'py></code></h3><pre><code><div class=\"where\">impl<'a, 'py> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.85.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"../types/iter/struct.BorrowedTupleIterator.html\" title=\"struct pyo3::types::iter::BorrowedTupleIterator\">BorrowedTupleIterator</a><'a, 'py></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.85.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"../struct.Borrowed.html\" title=\"struct pyo3::Borrowed\">Borrowed</a><'a, 'py, <a class=\"struct\" href=\"../types/struct.PyAny.html\" title=\"struct pyo3::types::PyAny\">PyAny</a>>;</div>","BoundTupleIterator<'py>":"<h3>Notable traits for <code><a class=\"struct\" href=\"../types/iter/struct.BoundTupleIterator.html\" title=\"struct pyo3::types::iter::BoundTupleIterator\">BoundTupleIterator</a><'py></code></h3><pre><code><div class=\"where\">impl<'py> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.85.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"../types/iter/struct.BoundTupleIterator.html\" title=\"struct pyo3::types::iter::BoundTupleIterator\">BoundTupleIterator</a><'py></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.85.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</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>>;</div>"}</script></section></div></main></body></html> |