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

6 lines
17 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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="PyO3s prelude."><title>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 mod"><!--[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="#">Module prelude</a></h2><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li><li><a href="#derives" title="Derive Macros">Derive Macros</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate pyo3</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></span><h1>Module <span>prelude</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/prelude.rs.html#1-52">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>PyO3s prelude.</p>
<p>The purpose of this module is to alleviate imports of many commonly used items of the PyO3 crate
by adding a glob import to the top of pyo3 heavy modules:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>pyo3::prelude::<span class="kw-2">*</span>;</code></pre></div>
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.FromPyObject"><code>pub use crate::conversion::<a class="trait" href="../conversion/trait.FromPyObject.html" title="trait pyo3::conversion::FromPyObject">FromPyObject</a>;</code></div></li><li><div class="item-name" id="reexport.IntoPyObject"><code>pub use crate::conversion::<a class="trait" href="../conversion/trait.IntoPyObject.html" title="trait pyo3::conversion::IntoPyObject">IntoPyObject</a>;</code></div></li><li><div class="item-name" id="reexport.IntoPy"><code>pub use crate::conversion::<a class="trait" href="../conversion/trait.IntoPy.html" title="trait pyo3::conversion::IntoPy">IntoPy</a>;</code></div><div class="desc docblock-short"><wbr><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.ToPyObject"><code>pub use crate::conversion::<a class="trait" href="../conversion/trait.ToPyObject.html" title="trait pyo3::conversion::ToPyObject">ToPyObject</a>;</code></div><div class="desc docblock-short"><wbr><span class="stab deprecated" title="">Deprecated</span></div></li><li><div class="item-name" id="reexport.Python"><code>pub use crate::marker::<a class="struct" href="../marker/struct.Python.html" title="struct pyo3::marker::Python">Python</a>;</code></div></li><li><div class="item-name" id="reexport.PyRef"><code>pub use crate::pycell::<a class="struct" href="../pycell/struct.PyRef.html" title="struct pyo3::pycell::PyRef">PyRef</a>;</code></div></li><li><div class="item-name" id="reexport.PyRefMut"><code>pub use crate::pycell::<a class="struct" href="../pycell/struct.PyRefMut.html" title="struct pyo3::pycell::PyRefMut">PyRefMut</a>;</code></div></li><li><div class="item-name" id="reexport.PyClassInitializer"><code>pub use crate::pyclass_init::<a class="struct" href="../pyclass_init/struct.PyClassInitializer.html" title="struct pyo3::pyclass_init::PyClassInitializer">PyClassInitializer</a>;</code></div></li><li><div class="item-name" id="reexport.PyAny"><code>pub use crate::types::<a class="struct" href="../types/struct.PyAny.html" title="struct pyo3::types::PyAny">PyAny</a>;</code></div></li><li><div class="item-name" id="reexport.PyModule"><code>pub use crate::types::<a class="struct" href="../types/struct.PyModule.html" title="struct pyo3::types::PyModule">PyModule</a>;</code></div></li></ul><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.wrap_pyfunction.html" title="macro pyo3::prelude::wrap_pyfunction">wrap_<wbr>pyfunction</a></div><div class="desc docblock-short">Wraps a Rust function annotated with <a href="../attr.pyfunction.html" title="attr pyo3::pyfunction"><code>#[pyfunction]</code></a>.</div></li><li><div class="item-name"><a class="macro" href="macro.wrap_pyfunction_bound.html" title="macro pyo3::prelude::wrap_pyfunction_bound">wrap_<wbr>pyfunction_<wbr>bound</a><wbr><span class="stab deprecated" title="">Deprecated</span></div><div class="desc docblock-short">Wraps a Rust function annotated with <a href="../attr.pyfunction.html" title="attr pyo3::pyfunction"><code>#[pyfunction]</code></a>.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Borrowed.html" title="struct pyo3::prelude::Borrowed">Borrowed</a></div><div class="desc docblock-short">A borrowed equivalent to <code>Bound</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Bound.html" title="struct pyo3::prelude::Bound">Bound</a></div><div class="desc docblock-short">A GIL-attached equivalent to <a href="../struct.Py.html" title="struct pyo3::Py"><code>Py&lt;T&gt;</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Py.html" title="struct pyo3::prelude::Py">Py</a></div><div class="desc docblock-short">A GIL-independent reference to an object allocated on the Python heap.</div></li><li><div class="item-name"><a class="struct" href="struct.PyErr.html" title="struct pyo3::prelude::PyErr">PyErr</a></div><div class="desc docblock-short">Represents a Python exception.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.PyAnyMethods.html" title="trait pyo3::prelude::PyAnyMethods">PyAny<wbr>Methods</a></div><div class="desc docblock-short">This trait represents the Python APIs which are usable on all Python objects.</div></li><li><div class="item-name"><a class="trait" href="trait.PyBoolMethods.html" title="trait pyo3::prelude::PyBoolMethods">PyBool<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyBool.html" title="struct pyo3::types::PyBool"><code>PyBool</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyByteArrayMethods.html" title="trait pyo3::prelude::PyByteArrayMethods">PyByte<wbr>Array<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyByteArray.html" title="struct pyo3::types::PyByteArray"><code>PyByteArray</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyBytesMethods.html" title="trait pyo3::prelude::PyBytesMethods">PyBytes<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyBytes.html" title="struct pyo3::types::PyBytes"><code>PyBytes</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyCapsuleMethods.html" title="trait pyo3::prelude::PyCapsuleMethods">PyCapsule<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyCapsule.html" title="struct pyo3::types::PyCapsule"><code>PyCapsule</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyComplexMethods.html" title="trait pyo3::prelude::PyComplexMethods">PyComplex<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyComplex.html" title="struct pyo3::types::PyComplex"><code>PyComplex</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyDictMethods.html" title="trait pyo3::prelude::PyDictMethods">PyDict<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyDict.html" title="struct pyo3::types::PyDict"><code>PyDict</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyFloatMethods.html" title="trait pyo3::prelude::PyFloatMethods">PyFloat<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyFloat.html" title="struct pyo3::types::PyFloat"><code>PyFloat</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyFrozenSetMethods.html" title="trait pyo3::prelude::PyFrozenSetMethods">PyFrozen<wbr>SetMethods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyFrozenSet.html" title="struct pyo3::types::PyFrozenSet"><code>PyFrozenSet</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyListMethods.html" title="trait pyo3::prelude::PyListMethods">PyList<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyList.html" title="struct pyo3::types::PyList"><code>PyList</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyMappingMethods.html" title="trait pyo3::prelude::PyMappingMethods">PyMapping<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyMapping.html" title="struct pyo3::types::PyMapping"><code>PyMapping</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyMappingProxyMethods.html" title="trait pyo3::prelude::PyMappingProxyMethods">PyMapping<wbr>Proxy<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyMappingProxy.html" title="struct pyo3::types::PyMappingProxy"><code>PyMappingProxy</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyModuleMethods.html" title="trait pyo3::prelude::PyModuleMethods">PyModule<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyModule.html" title="struct pyo3::types::PyModule"><code>PyModule</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PySequenceMethods.html" title="trait pyo3::prelude::PySequenceMethods">PySequence<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PySequence.html" title="struct pyo3::types::PySequence"><code>PySequence</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PySetMethods.html" title="trait pyo3::prelude::PySetMethods">PySet<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PySet.html" title="struct pyo3::types::PySet"><code>PySet</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PySliceMethods.html" title="trait pyo3::prelude::PySliceMethods">PySlice<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PySlice.html" title="struct pyo3::types::PySlice"><code>PySlice</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyStringMethods.html" title="trait pyo3::prelude::PyStringMethods">PyString<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyString.html" title="struct pyo3::types::PyString"><code>PyString</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyTracebackMethods.html" title="trait pyo3::prelude::PyTracebackMethods">PyTraceback<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyTraceback.html" title="struct pyo3::types::PyTraceback"><code>PyTraceback</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyTupleMethods.html" title="trait pyo3::prelude::PyTupleMethods">PyTuple<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyTuple.html" title="struct pyo3::types::PyTuple"><code>PyTuple</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyTypeMethods.html" title="trait pyo3::prelude::PyTypeMethods">PyType<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyType.html" title="struct pyo3::types::PyType"><code>PyType</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.PyWeakrefMethods.html" title="trait pyo3::prelude::PyWeakrefMethods">PyWeakref<wbr>Methods</a></div><div class="desc docblock-short">Implementation of functionality for <a href="../types/struct.PyWeakref.html" title="struct pyo3::types::PyWeakref"><code>PyWeakref</code></a>.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.PyObject.html" title="type pyo3::prelude::PyObject">PyObject</a></div><div class="desc docblock-short">A commonly-used alias for <code>Py&lt;PyAny&gt;</code>.</div></li><li><div class="item-name"><a class="type" href="type.PyResult.html" title="type pyo3::prelude::PyResult">PyResult</a></div><div class="desc docblock-short">Represents the result of a Python call.</div></li></ul><h2 id="attributes" class="section-header">Attribute Macros<a href="#attributes" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="attr" href="attr.pyclass.html" title="attr pyo3::prelude::pyclass">pyclass</a></div></li><li><div class="item-name"><a class="attr" href="attr.pyfunction.html" title="attr pyo3::prelude::pyfunction">pyfunction</a></div><div class="desc docblock-short">A proc macro used to expose Rust functions to Python.</div></li><li><div class="item-name"><a class="attr" href="attr.pymethods.html" title="attr pyo3::prelude::pymethods">pymethods</a></div><div class="desc docblock-short">A proc macro used to expose methods to Python.</div></li><li><div class="item-name"><a class="attr" href="attr.pymodule.html" title="attr pyo3::prelude::pymodule">pymodule</a></div><div class="desc docblock-short">A proc macro used to implement Python modules.</div></li></ul><h2 id="derives" class="section-header">Derive Macros<a href="#derives" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="derive" href="derive.FromPyObject.html" title="derive pyo3::prelude::FromPyObject">From<wbr>PyObject</a></div></li><li><div class="item-name"><a class="derive" href="derive.IntoPyObject.html" title="derive pyo3::prelude::IntoPyObject">Into<wbr>PyObject</a></div></li><li><div class="item-name"><a class="derive" href="derive.IntoPyObjectRef.html" title="derive pyo3::prelude::IntoPyObjectRef">Into<wbr>PyObject<wbr>Ref</a></div></li></ul></section></div></main></body></html>