Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 4e2dbb669434a7691662cb2f0ad38972 > files > 14141

rust-doc-1.28.0-1.mga6.armv7hl.rpm

<!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="API documentation for the Rust `prelude` mod in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, prelude"><title>std::prelude - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a><p class='location'>Module prelude</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li></ul></div><p class='location'><a href='../index.html'>std</a></p><script>window.sidebarCurrent = {name: 'prelude', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>std</a>::<wbr><a class="mod" href=''>prelude</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/std/prelude/mod.rs.html#11-148' title='goto source code'>[src]</a></span></h1><div class='docblock'><p>The Rust Prelude.</p>
<p>Rust comes with a variety of things in its standard library. However, if
you had to manually import every single thing that you used, it would be
very verbose. But importing a lot of things that a program never uses isn't
good either. A balance needs to be struck.</p>
<p>The <em>prelude</em> is the list of things that Rust automatically imports into
every Rust program. It's kept as small as possible, and is focused on
things, particularly traits, which are used in almost every single Rust
program.</p>
<p>On a technical level, Rust inserts</p>

<pre class="rust rust-example-rendered">
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">std</span>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%23%5Ballow(unused_extern_crates)%5D%0Aextern%20crate%20std%3B%0A%7D">Run</a></pre>
<p>into the crate root of every crate, and</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">prelude</span>::<span class="ident">v1</span>::<span class="kw-2">*</span>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%23%5Ballow(unused_imports)%5D%0Ause%20std%3A%3Aprelude%3A%3Av1%3A%3A*%3B%0A%7D">Run</a></pre>
<p>into every module.</p>
<h1 id="other-preludes" class="section-header"><a href="#other-preludes">Other preludes</a></h1>
<p>Preludes can be seen as a pattern to make using multiple types more
convenient. As such, you'll find other preludes in the standard library,
such as <a href="../io/prelude/index.html"><code>std::io::prelude</code></a>. Various libraries in the Rust ecosystem may
also define their own preludes.</p>
<p>The difference between 'the prelude' and these other preludes is that they
are not automatically <code>use</code>'d, and must be imported manually. This is still
easier than importing all of their constituent components.</p>
<h1 id="prelude-contents" class="section-header"><a href="#prelude-contents">Prelude contents</a></h1>
<p>The current version of the prelude (version 1) lives in
<a href="v1/index.html"><code>std::prelude::v1</code></a>, and re-exports the following.</p>
<ul>
<li><a href="../marker/index.html"><code>std::marker</code></a>::{<a href="../marker/trait.Copy.html"><code>Copy</code></a>, <a href="../marker/trait.Send.html"><code>Send</code></a>, <a href="../marker/trait.Sized.html"><code>Sized</code></a>, <a href="../marker/trait.Sync.html"><code>Sync</code></a>}. The marker
traits indicate fundamental properties of types.</li>
<li><a href="../ops/index.html"><code>std::ops</code></a>::{<a href="../ops/trait.Drop.html"><code>Drop</code></a>, <a href="../ops/trait.Fn.html"><code>Fn</code></a>, <a href="../ops/trait.FnMut.html"><code>FnMut</code></a>, <a href="../ops/trait.FnOnce.html"><code>FnOnce</code></a>}. Various
operations for both destructors and overloading <code>()</code>.</li>
<li><a href="../mem/index.html"><code>std::mem</code></a>::<a href="../mem/fn.drop.html"><code>drop</code></a>, a convenience function for explicitly
dropping a value.</li>
<li><a href="../boxed/index.html"><code>std::boxed</code></a>::<a href="../boxed/struct.Box.html"><code>Box</code></a>, a way to allocate values on the heap.</li>
<li><a href="../borrow/index.html"><code>std::borrow</code></a>::<a href="../borrow/trait.ToOwned.html"><code>ToOwned</code></a>, The conversion trait that defines
<a href="../borrow/trait.ToOwned.html#tymethod.to_owned"><code>to_owned</code></a>, the generic method for creating an owned type from a
borrowed type.</li>
<li><a href="../clone/index.html"><code>std::clone</code></a>::<a href="../clone/trait.Clone.html"><code>Clone</code></a>, the ubiquitous trait that defines
<a href="../clone/trait.Clone.html#tymethod.clone"><code>clone</code></a>, the method for producing a copy of a value.</li>
<li><a href="../cmp/index.html"><code>std::cmp</code></a>::{<a href="../cmp/trait.PartialEq.html"><code>PartialEq</code></a>, <a href="../cmp/trait.PartialOrd.html"><code>PartialOrd</code></a>, <a href="../cmp/trait.Eq.html"><code>Eq</code></a>, <a href="../cmp/trait.Ord.html"><code>Ord</code></a> }. The
comparison traits, which implement the comparison operators and are often
seen in trait bounds.</li>
<li><a href="../convert/index.html"><code>std::convert</code></a>::{<a href="../convert/trait.AsRef.html"><code>AsRef</code></a>, <a href="../convert/trait.AsMut.html"><code>AsMut</code></a>, <a href="../convert/trait.Into.html"><code>Into</code></a>, <a href="../convert/trait.From.html"><code>From</code></a>}. Generic
conversions, used by savvy API authors to create overloaded methods.</li>
<li><a href="../default/index.html"><code>std::default</code></a>::<a href="../default/trait.Default.html"><code>Default</code></a>, types that have default values.</li>
<li><a href="../iter/index.html"><code>std::iter</code></a>::{<a href="../iter/trait.Iterator.html"><code>Iterator</code></a>, <a href="../iter/trait.Extend.html"><code>Extend</code></a>, <a href="../iter/trait.IntoIterator.html"><code>IntoIterator</code></a>,
<a href="../iter/trait.DoubleEndedIterator.html"><code>DoubleEndedIterator</code></a>, <a href="../iter/trait.ExactSizeIterator.html"><code>ExactSizeIterator</code></a>}. Iterators of various
kinds.</li>
<li><a href="../option/index.html"><code>std::option</code></a>::<a href="../option/enum.Option.html"><code>Option</code></a>::{<code>self</code>, <code>Some</code>, <code>None</code>}. A type which
expresses the presence or absence of a value. This type is so commonly
used, its variants are also exported.</li>
<li><a href="../result/index.html"><code>std::result</code></a>::<a href="../result/enum.Result.html"><code>Result</code></a>::{<code>self</code>, <code>Ok</code>, <code>Err</code>}. A type for functions
that may succeed or fail. Like <a href="../option/enum.Option.html"><code>Option</code></a>, its variants are exported as
well.</li>
<li><a href="../slice/index.html"><code>std::slice</code></a>::<a href="../slice/trait.SliceConcatExt.html"><code>SliceConcatExt</code></a>, a trait that exists for technical
reasons, but shouldn't have to exist. It provides a few useful methods on
slices.</li>
<li><a href="../string/index.html"><code>std::string</code></a>::{<a href="../string/struct.String.html"><code>String</code></a>, <a href="../string/trait.ToString.html"><code>ToString</code></a>}, heap allocated strings.</li>
<li><a href="../vec/index.html"><code>std::vec</code></a>::<a href="../vec/struct.Vec.html"><code>Vec</code></a>, a growable, heap-allocated
vector.</li>
</ul>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="mod" href="v1/index.html"
                                  title='mod std::prelude::v1'>v1</a></td>
                           <td class='docblock-short'>
                                <p>The first version of the prelude of The Rust Standard Library.</p>

                           </td>
                       </tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "std";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>