193 lines
No EOL
11 KiB
HTML
193 lines
No EOL
11 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 `prelude` mod in crate `bitflags`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, prelude">
|
||
|
||
<title>bitflags::__core::prelude - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a></p><script>window.sidebarCurrent = {name: 'prelude', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<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">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content mod">
|
||
<h1 class='fqn'><span class='in-band'>Module <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a class='mod' href=''>prelude</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a id='src-186' class='srclink' href='https://doc.rust-lang.org/nightly/std/prelude/index.html?gotosrc=186' 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>;</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='op'>*</span>;</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 reexports 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="../mem/fn.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='bitflags::__core::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>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</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>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../../";
|
||
window.currentCrate = "bitflags";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../../jquery.js"></script>
|
||
<script src="../../../main.js"></script>
|
||
|
||
<script defer src="../../../search-index.js"></script>
|
||
</body>
|
||
</html> |