64 lines
9.8 KiB
HTML
64 lines
9.8 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="API documentation for the Rust `v1` mod in crate `nom`."><meta name="keywords" content="rust, rustlang, rust-lang, v1"><title>nom::lib::std::prelude::v1 - 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><noscript><link rel="stylesheet" href="../../../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../../../down-arrow.svg");}</style></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">☰</div><a href='../../../../../nom/index.html'><div class='logo-container'><img src='../../../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module v1</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'>nom</a>::<wbr><a href='../../../index.html'>lib</a>::<wbr><a href='../../index.html'>std</a>::<wbr><a href='../index.html'>prelude</a></p><script>window.sidebarCurrent = {name: 'v1', 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"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><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='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'>−</span>]</a></span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/lib.rs.html#350' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../../../index.html'>nom</a>::<wbr><a href='../../../index.html'>lib</a>::<wbr><a href='../../index.html'>std</a>::<wbr><a href='../index.html'>prelude</a>::<wbr><a class="mod" href=''>v1</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>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">std</span>;</pre></div>
|
||
<p>into the crate root of every crate, and</p>
|
||
|
||
<div class="example-wrap"><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>;</pre></div>
|
||
<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>, <a href="../marker/trait.Unpin.html"><code>Unpin</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="../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='nom::lib::std::prelude::v1::v1 mod'>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><script>window.rootPath = "../../../../../";window.currentCrate = "nom";</script><script src="../../../../../aliases.js"></script><script src="../../../../../main.js"></script><script defer src="../../../../../search-index.js"></script></body></html> |