Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 0c2243f8a1696816431e7210e991fa52 > files > 14664

rust-doc-1.35.0-1.mga7.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 `From` trait in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, From"><title>std::convert::From - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize1.35.0.css"><link rel="stylesheet" type="text/css" href="../../rustdoc1.35.0.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark1.35.0.css"><link rel="stylesheet" type="text/css" href="../../light1.35.0.css" id="themeStyle"><script src="../../storage1.35.0.js"></script><noscript><link rel="stylesheet" href="../../noscript1.35.0.css"></noscript><link rel="shortcut icon" href="../../favicon1.35.0.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow1.35.0.svg");}</style></head><body class="rustdoc trait"><!--[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='../../rust-logo1.35.0.png' alt='logo' width='100'></a><p class='location'>Trait From</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.from">from</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>convert</a></p><script>window.sidebarCurrent = {name: 'From', ty: 'trait', 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="../../brush1.35.0.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme1.35.0.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" 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="../../wheel1.35.0.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'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/core/convert.rs.html#374-378' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>std</a>::<wbr><a href='index.html'>convert</a>::<wbr><a class="trait" href=''>From</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait From&lt;T&gt; {
    fn <a href='#tymethod.from' class='fnname'>from</a>(T) -&gt; Self;
}</pre></div><div class='docblock'><p>Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
<a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a>.</p>
<p>One should always prefer implementing <a href="trait.From.html#tymethod.from"><code>From</code></a> over <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a>
because implementing <a href="trait.From.html#tymethod.from"><code>From</code></a> automatically provides one with a implementation of <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a>
thanks to the blanket implementation in the standard library.</p>
<p>Only implement <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a> if a conversion to a type outside the current crate is required.
<a href="trait.From.html#tymethod.from"><code>From</code></a> cannot do these type of conversions because of Rust's orphaning rules.
See <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a> for more details.</p>
<p>Prefer using <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a> over using <a href="trait.From.html#tymethod.from"><code>From</code></a> when specifying trait bounds on a generic function.
This way, types that directly implement <a href="../../std/convert/trait.Into.html" title="`Into`"><code>Into</code></a> can be used as arguments as well.</p>
<p>The <a href="trait.From.html#tymethod.from"><code>From</code></a> is also very useful when performing error handling. When constructing a function
that is capable of failing, the return type will generally be of the form <code>Result&lt;T, E&gt;</code>.
The <code>From</code> trait simplifies error handling by allowing a function to return a single error type
that encapsulate multiple error types. See the &quot;Examples&quot; section and <a href="../../book/ch09-00-error-handling.html">the book</a> for more
details.</p>
<p><strong>Note: This trait must not fail</strong>. If the conversion can fail, use <a href="trait.TryFrom.html"><code>TryFrom</code></a>.</p>
<h1 id="generic-implementations" class="section-header"><a href="#generic-implementations">Generic Implementations</a></h1>
<ul>
<li>[<code>From&lt;T&gt;</code>]<code>for U</code> implies <a href="trait.Into.html"><code>Into&lt;U&gt;</code></a><code>for T</code></li>
<li><a href="trait.From.html#tymethod.from"><code>From</code></a> is reflexive, which means that <code>From&lt;T&gt; for T</code> is implemented</li>
</ul>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p><a href="../../std/string/struct.String.html"><code>String</code></a> implements <code>From&lt;&amp;str&gt;</code>:</p>
<p>An explicit conversion from a &amp;str to a String is done as follows:</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">string</span> <span class="op">=</span> <span class="string">&quot;hello&quot;</span>.<span class="ident">to_string</span>();
<span class="kw">let</span> <span class="ident">other_string</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;hello&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">string</span>, <span class="ident">other_string</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20string%20%3D%20%22hello%22.to_string()%3B%0Alet%20other_string%20%3D%20String%3A%3Afrom(%22hello%22)%3B%0A%0Aassert_eq!(string%2C%20other_string)%3B%0A%7D">Run</a></pre></div>
<p>While performing error handling it is often useful to implement <code>From</code> for your own error type.
By converting underlying error types to our own custom error type that encapsulates the
underlying error type, we can return a single error type without losing information on the
underlying cause. The '?' operator automatically converts the underlying error type to our
custom error type by calling <code>Into&lt;CliError&gt;::into</code> which is automatically provided when
implementing <code>From</code>. The compiler then infers which implementation of <code>Into</code> should be used.</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">num</span>;

<span class="kw">enum</span> <span class="ident">CliError</span> {
    <span class="ident">IoError</span>(<span class="ident">io</span>::<span class="ident">Error</span>),
    <span class="ident">ParseError</span>(<span class="ident">num</span>::<span class="ident">ParseIntError</span>),
}

<span class="kw">impl</span> <span class="ident">From</span><span class="op">&lt;</span><span class="ident">io</span>::<span class="ident">Error</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">CliError</span> {
    <span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">error</span>: <span class="ident">io</span>::<span class="ident">Error</span>) <span class="op">-&gt;</span> <span class="self">Self</span> {
        <span class="ident">CliError</span>::<span class="ident">IoError</span>(<span class="ident">error</span>)
    }
}

<span class="kw">impl</span> <span class="ident">From</span><span class="op">&lt;</span><span class="ident">num</span>::<span class="ident">ParseIntError</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">CliError</span> {
    <span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">error</span>: <span class="ident">num</span>::<span class="ident">ParseIntError</span>) <span class="op">-&gt;</span> <span class="self">Self</span> {
        <span class="ident">CliError</span>::<span class="ident">ParseError</span>(<span class="ident">error</span>)
    }
}

<span class="kw">fn</span> <span class="ident">open_and_parse_file</span>(<span class="ident">file_name</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">i32</span>, <span class="ident">CliError</span><span class="op">&gt;</span> {
    <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">contents</span> <span class="op">=</span> <span class="ident">fs</span>::<span class="ident">read_to_string</span>(<span class="kw-2">&amp;</span><span class="ident">file_name</span>)<span class="question-mark">?</span>;
    <span class="kw">let</span> <span class="ident">num</span>: <span class="ident">i32</span> <span class="op">=</span> <span class="ident">contents</span>.<span class="ident">trim</span>().<span class="ident">parse</span>()<span class="question-mark">?</span>;
    <span class="prelude-val">Ok</span>(<span class="ident">num</span>)
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3B%0Ause%20std%3A%3Aio%3B%0Ause%20std%3A%3Anum%3B%0A%0Aenum%20CliError%20%7B%0A%20%20%20%20IoError(io%3A%3AError)%2C%0A%20%20%20%20ParseError(num%3A%3AParseIntError)%2C%0A%7D%0A%0Aimpl%20From%3Cio%3A%3AError%3E%20for%20CliError%20%7B%0A%20%20%20%20fn%20from(error%3A%20io%3A%3AError)%20-%3E%20Self%20%7B%0A%20%20%20%20%20%20%20%20CliError%3A%3AIoError(error)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20From%3Cnum%3A%3AParseIntError%3E%20for%20CliError%20%7B%0A%20%20%20%20fn%20from(error%3A%20num%3A%3AParseIntError)%20-%3E%20Self%20%7B%0A%20%20%20%20%20%20%20%20CliError%3A%3AParseError(error)%0A%20%20%20%20%7D%0A%7D%0A%0Afn%20open_and_parse_file(file_name%3A%20%26str)%20-%3E%20Result%3Ci32%2C%20CliError%3E%20%7B%0A%20%20%20%20let%20mut%20contents%20%3D%20fs%3A%3Aread_to_string(%26file_name)%3F%3B%0A%20%20%20%20let%20num%3A%20i32%20%3D%20contents.trim().parse()%3F%3B%0A%20%20%20%20Ok(num)%0A%7D%0A%7D">Run</a></pre></div>
</div>
            <h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.from' class='method'><code id='from.v'>fn <a href='#tymethod.from' class='fnname'>from</a>(T) -&gt; Self</code></h3><div class='docblock'><p>Performs the conversion.</p>
</div></div><span class='loading-content'>Loading content...</span>
            <h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-From%3CInfallible%3E' class='impl'><code class='in-band'>impl From&lt;<a class="enum" href="../../std/convert/enum.Infallible.html" title="enum std::convert::Infallible">Infallible</a>&gt; for <a class="struct" href="../../std/num/struct.TryFromIntError.html" title="struct std::num::TryFromIntError">TryFromIntError</a></code><a href='#impl-From%3CInfallible%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4432-4436' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v-1'>fn <a href='#method.from' class='fnname'>from</a>(x: <a class="enum" href="../../std/convert/enum.Infallible.html" title="enum std::convert::Infallible">Infallible</a>) -&gt; <a class="struct" href="../../std/num/struct.TryFromIntError.html" title="struct std::num::TryFromIntError">TryFromIntError</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4433-4435' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CErrorKind%3E' class='impl'><code class='in-band'>impl From&lt;<a class="enum" href="../../std/io/enum.ErrorKind.html" title="enum std::io::ErrorKind">ErrorKind</a>&gt; for <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a href='#impl-From%3CErrorKind%3E' class='anchor'></a><a class='srclink' href='../../src/std/io/error.rs.html#204-227' title='goto source code'>[src]</a></h3><div class='docblock'><p>Intended for use for errors not exposed to the user, where allocating onto
the heap (for normal construction via Error::new) is too costly.</p>
</div><div class='impl-items'><h4 id='method.from-1' class="method"><code id='from.v-2'>fn <a href='#method.from-1' class='fnname'>from</a>(kind: <a class="enum" href="../../std/io/enum.ErrorKind.html" title="enum std::io::ErrorKind">ErrorKind</a>) -&gt; <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a class='srclink' href='../../src/std/io/error.rs.html#222-226' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <a href="../../std/io/enum.ErrorKind.html"><code>ErrorKind</code></a> into an <a href="../../std/io/struct.Error.html"><code>Error</code></a>.</p>
<p>This conversion allocates a new error with a simple representation of error kind.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="ident">Error</span>, <span class="ident">ErrorKind</span>};

<span class="kw">let</span> <span class="ident">not_found</span> <span class="op">=</span> <span class="ident">ErrorKind</span>::<span class="ident">NotFound</span>;
<span class="kw">let</span> <span class="ident">error</span> <span class="op">=</span> <span class="ident">Error</span>::<span class="ident">from</span>(<span class="ident">not_found</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;entity not found&quot;</span>, <span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">error</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aio%3A%3A%7BError%2C%20ErrorKind%7D%3B%0A%0Alet%20not_found%20%3D%20ErrorKind%3A%3ANotFound%3B%0Alet%20error%20%3D%20Error%3A%3Afrom(not_found)%3B%0Aassert_eq!(%22entity%20not%20found%22%2C%20format!(%22%7B%7D%22%2C%20error))%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%5Bu16%3B%208%5D%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>&gt; for <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a href='#impl-From%3C%5Bu16%3B%208%5D%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1482-1507' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-2' class="method"><code id='from.v-3'>fn <a href='#method.from-2' class='fnname'>from</a>(segments: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>) -&gt; <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1504-1506' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an <code>IpAddr::V6</code> from an eight element 16-bit array.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">IpAddr</span>, <span class="ident">Ipv6Addr</span>};

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">IpAddr</span>::<span class="ident">from</span>([
    <span class="number">525u16</span>, <span class="number">524u16</span>, <span class="number">523u16</span>, <span class="number">522u16</span>,
    <span class="number">521u16</span>, <span class="number">520u16</span>, <span class="number">519u16</span>, <span class="number">518u16</span>,
]);
<span class="macro">assert_eq</span><span class="macro">!</span>(
    <span class="ident">IpAddr</span>::<span class="ident">V6</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(
        <span class="number">0x20d</span>, <span class="number">0x20c</span>,
        <span class="number">0x20b</span>, <span class="number">0x20a</span>,
        <span class="number">0x209</span>, <span class="number">0x208</span>,
        <span class="number">0x207</span>, <span class="number">0x206</span>
    )),
    <span class="ident">addr</span>
);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3A%7BIpAddr%2C%20Ipv6Addr%7D%3B%0A%0Alet%20addr%20%3D%20IpAddr%3A%3Afrom(%5B%0A%20%20%20%20525u16%2C%20524u16%2C%20523u16%2C%20522u16%2C%0A%20%20%20%20521u16%2C%20520u16%2C%20519u16%2C%20518u16%2C%0A%5D)%3B%0Aassert_eq!(%0A%20%20%20%20IpAddr%3A%3AV6(Ipv6Addr%3A%3Anew(%0A%20%20%20%20%20%20%20%200x20d%2C%200x20c%2C%0A%20%20%20%20%20%20%20%200x20b%2C%200x20a%2C%0A%20%20%20%20%20%20%20%200x209%2C%200x208%2C%0A%20%20%20%20%20%20%20%200x207%2C%200x206%0A%20%20%20%20))%2C%0A%20%20%20%20addr%0A)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%5Bu16%3B%208%5D%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>&gt; for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a href='#impl-From%3C%5Bu16%3B%208%5D%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1445-1450' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-3' class="method hidden"><code id='from.v-4'>fn <a href='#method.from-3' class='fnname'>from</a>(segments: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>) -&gt; <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1446-1449' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%5Bu8%3B%204%5D%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 4]</a>&gt; for <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a href='#impl-From%3C%5Bu8%3B%204%5D%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#835-849' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-4' class="method"><code id='from.v-5'>fn <a href='#method.from-4' class='fnname'>from</a>(octets: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 4]</a>) -&gt; <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#846-848' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an <code>IpAddr::V4</code> from a four element byte array.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">IpAddr</span>, <span class="ident">Ipv4Addr</span>};

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">IpAddr</span>::<span class="ident">from</span>([<span class="number">13u8</span>, <span class="number">12u8</span>, <span class="number">11u8</span>, <span class="number">10u8</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">IpAddr</span>::<span class="ident">V4</span>(<span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">13</span>, <span class="number">12</span>, <span class="number">11</span>, <span class="number">10</span>)), <span class="ident">addr</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3A%7BIpAddr%2C%20Ipv4Addr%7D%3B%0A%0Alet%20addr%20%3D%20IpAddr%3A%3Afrom(%5B13u8%2C%2012u8%2C%2011u8%2C%2010u8%5D)%3B%0Aassert_eq!(IpAddr%3A%3AV4(Ipv4Addr%3A%3Anew(13%2C%2012%2C%2011%2C%2010))%2C%20addr)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%5Bu8%3B%2016%5D%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>&gt; for <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a href='#impl-From%3C%5Bu8%3B%2016%5D%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1454-1479' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-5' class="method"><code id='from.v-6'>fn <a href='#method.from-5' class='fnname'>from</a>(octets: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>) -&gt; <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1476-1478' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an <code>IpAddr::V6</code> from a sixteen element byte array.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">IpAddr</span>, <span class="ident">Ipv6Addr</span>};

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">IpAddr</span>::<span class="ident">from</span>([
    <span class="number">25u8</span>, <span class="number">24u8</span>, <span class="number">23u8</span>, <span class="number">22u8</span>, <span class="number">21u8</span>, <span class="number">20u8</span>, <span class="number">19u8</span>, <span class="number">18u8</span>,
    <span class="number">17u8</span>, <span class="number">16u8</span>, <span class="number">15u8</span>, <span class="number">14u8</span>, <span class="number">13u8</span>, <span class="number">12u8</span>, <span class="number">11u8</span>, <span class="number">10u8</span>,
]);
<span class="macro">assert_eq</span><span class="macro">!</span>(
    <span class="ident">IpAddr</span>::<span class="ident">V6</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(
        <span class="number">0x1918</span>, <span class="number">0x1716</span>,
        <span class="number">0x1514</span>, <span class="number">0x1312</span>,
        <span class="number">0x1110</span>, <span class="number">0x0f0e</span>,
        <span class="number">0x0d0c</span>, <span class="number">0x0b0a</span>
    )),
    <span class="ident">addr</span>
);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3A%7BIpAddr%2C%20Ipv6Addr%7D%3B%0A%0Alet%20addr%20%3D%20IpAddr%3A%3Afrom(%5B%0A%20%20%20%2025u8%2C%2024u8%2C%2023u8%2C%2022u8%2C%2021u8%2C%2020u8%2C%2019u8%2C%2018u8%2C%0A%20%20%20%2017u8%2C%2016u8%2C%2015u8%2C%2014u8%2C%2013u8%2C%2012u8%2C%2011u8%2C%2010u8%2C%0A%5D)%3B%0Aassert_eq!(%0A%20%20%20%20IpAddr%3A%3AV6(Ipv6Addr%3A%3Anew(%0A%20%20%20%20%20%20%20%200x1918%2C%200x1716%2C%0A%20%20%20%20%20%20%20%200x1514%2C%200x1312%2C%0A%20%20%20%20%20%20%20%200x1110%2C%200x0f0e%2C%0A%20%20%20%20%20%20%20%200x0d0c%2C%200x0b0a%0A%20%20%20%20))%2C%0A%20%20%20%20addr%0A)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%5Bu8%3B%2016%5D%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>&gt; for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a href='#impl-From%3C%5Bu8%3B%2016%5D%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1437-1442' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-6' class="method hidden"><code id='from.v-7'>fn <a href='#method.from-6' class='fnname'>from</a>(octets: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>) -&gt; <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1438-1441' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%5Bu8%3B%204%5D%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 4]</a>&gt; for <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a></code><a href='#impl-From%3C%5Bu8%3B%204%5D%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#820-832' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-7' class="method"><code id='from.v-8'>fn <a href='#method.from-7' class='fnname'>from</a>(octets: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 4]</a>) -&gt; <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#829-831' title='goto source code'>[src]</a></h4><div class='docblock'><h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv4Addr</span>;

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv4Addr</span>::<span class="ident">from</span>([<span class="number">13u8</span>, <span class="number">12u8</span>, <span class="number">11u8</span>, <span class="number">10u8</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">13</span>, <span class="number">12</span>, <span class="number">11</span>, <span class="number">10</span>), <span class="ident">addr</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv4Addr%3B%0A%0Alet%20addr%20%3D%20Ipv4Addr%3A%3Afrom(%5B13u8%2C%2012u8%2C%2011u8%2C%2010u8%5D)%3B%0Aassert_eq!(Ipv4Addr%3A%3Anew(13%2C%2012%2C%2011%2C%2010)%2C%20addr)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cbool%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Cbool%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>i128</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i128</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i128</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(i128%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(i128%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-8' class="method hidden"><code id='from.v-9'>fn <a href='#method.from-8' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.i16.html">i16</a></code><a href='#impl-From%3Cbool%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>i16</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i16</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i16</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(i16%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(i16%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-9' class="method hidden"><code id='from.v-10'>fn <a href='#method.from-9' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.i16.html">i16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3Cbool%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>i32</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(i32%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(i32%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-10' class="method hidden"><code id='from.v-11'>fn <a href='#method.from-10' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Cbool%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>i64</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i64</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i64</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(i64%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(i64%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-11' class="method hidden"><code id='from.v-12'>fn <a href='#method.from-11' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.i8.html">i8</a></code><a href='#impl-From%3Cbool%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>i8</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i8</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i8</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(i8%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(i8%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-12' class="method hidden"><code id='from.v-13'>fn <a href='#method.from-12' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.i8.html">i8</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.isize.html">isize</a></code><a href='#impl-From%3Cbool%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>isize</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">isize</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">isize</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(isize%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(isize%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-13' class="method hidden"><code id='from.v-14'>fn <a href='#method.from-13' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.isize.html">isize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3Cbool%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>u128</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u128</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u128</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(u128%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(u128%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-14' class="method hidden"><code id='from.v-15'>fn <a href='#method.from-14' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-7' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.u16.html">u16</a></code><a href='#impl-From%3Cbool%3E-7' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>u16</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u16</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u16</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(u16%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(u16%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-15' class="method hidden"><code id='from.v-16'>fn <a href='#method.from-15' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.u16.html">u16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-8' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3Cbool%3E-8' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>u32</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u32</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u32</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(u32%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(u32%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-16' class="method hidden"><code id='from.v-17'>fn <a href='#method.from-16' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-9' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.u64.html">u64</a></code><a href='#impl-From%3Cbool%3E-9' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>u64</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u64</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u64</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(u64%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(u64%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-17' class="method hidden"><code id='from.v-18'>fn <a href='#method.from-17' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.u64.html">u64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-10' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.u8.html">u8</a></code><a href='#impl-From%3Cbool%3E-10' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>u8</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u8</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u8</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(u8%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(u8%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-18' class="method hidden"><code id='from.v-19'>fn <a href='#method.from-18' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.u8.html">u8</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-11' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="primitive" href="../primitive.usize.html">usize</a></code><a href='#impl-From%3Cbool%3E-11' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts a <code>bool</code> to a <code>usize</code>. The resulting value is <code>0</code> for <code>false</code> and <code>1</code> for <code>true</code>
values.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">usize</span>::<span class="ident">from</span>(<span class="bool-val">true</span>), <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">usize</span>::<span class="ident">from</span>(<span class="bool-val">false</span>), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aassert_eq!(usize%3A%3Afrom(true)%2C%201)%3B%0Aassert_eq!(usize%3A%3Afrom(false)%2C%200)%3B%0A%7D">Run</a></pre></div>
</div><div class='impl-items'><h4 id='method.from-19' class="method hidden"><code id='from.v-20'>fn <a href='#method.from-19' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cbool%3E-12' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.bool.html">bool</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicBool.html" title="struct std::sync::atomic::AtomicBool">AtomicBool</a></code><a href='#impl-From%3Cbool%3E-12' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1114-1126' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-20' class="method"><code id='from.v-21'>fn <a href='#method.from-20' class='fnname'>from</a>(b: <a class="primitive" href="../primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicBool.html" title="struct std::sync::atomic::AtomicBool">AtomicBool</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1125' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>bool</code> into an <code>AtomicBool</code>.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">sync</span>::<span class="ident">atomic</span>::<span class="ident">AtomicBool</span>;
<span class="kw">let</span> <span class="ident">atomic_bool</span> <span class="op">=</span> <span class="ident">AtomicBool</span>::<span class="ident">from</span>(<span class="bool-val">true</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">atomic_bool</span>), <span class="string">&quot;true&quot;</span>)<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Async%3A%3Aatomic%3A%3AAtomicBool%3B%0Alet%20atomic_bool%20%3D%20AtomicBool%3A%3Afrom(true)%3B%0Aassert_eq!(format!(%22%7B%3A%3F%7D%22%2C%20atomic_bool)%2C%20%22true%22)%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cchar%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.char.html">char</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3Cchar%3E' class='anchor'></a><a class='srclink' href='../../src/core/char/convert.rs.html#105-123' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-21' class="method"><code id='from.v-22'>fn <a href='#method.from-21' class='fnname'>from</a>(c: <a class="primitive" href="../primitive.char.html">char</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/core/char/convert.rs.html#120-122' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/char/index.html" title="`char`"><code>char</code></a> into a <a href="../../std/u32/index.html" title="`u32`"><code>u32</code></a>.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">fn</span> <span class="ident">main</span>() {
    <span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="string">&#39;c&#39;</span>;
    <span class="kw">let</span> <span class="ident">u</span> <span class="op">=</span> <span class="ident">u32</span>::<span class="ident">from</span>(<span class="ident">c</span>);
    <span class="macro">assert</span><span class="macro">!</span>(<span class="number">4</span> <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">u</span>))
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Ause%20std%3A%3Amem%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20c%20%3D%20'c'%3B%0A%20%20%20%20let%20u%20%3D%20u32%3A%3Afrom(c)%3B%0A%20%20%20%20assert!(4%20%3D%3D%20mem%3A%3Asize_of_val(%26u))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cf32%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.f32.html">f32</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Cf32%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>f32</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-22' class="method hidden"><code id='from.v-23'>fn <a href='#method.from-22' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.f32.html">f32</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.isize.html">isize</a></code><a href='#impl-From%3Ci16%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>isize</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-23' class="method hidden"><code id='from.v-24'>fn <a href='#method.from-23' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.isize.html">isize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.f32.html">f32</a></code><a href='#impl-From%3Ci16%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>f32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-24' class="method hidden"><code id='from.v-25'>fn <a href='#method.from-24' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.f32.html">f32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Ci16%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-25' class="method hidden"><code id='from.v-26'>fn <a href='#method.from-25' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Ci16%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-26' class="method hidden"><code id='from.v-27'>fn <a href='#method.from-26' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3Ci16%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>i32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-27' class="method hidden"><code id='from.v-28'>fn <a href='#method.from-27' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Ci16%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i16</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-28' class="method hidden"><code id='from.v-29'>fn <a href='#method.from-28' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci16%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i16.html">i16</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicI16.html" title="struct std::sync::atomic::AtomicI16">AtomicI16</a></code><a href='#impl-From%3Ci16%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-29' class="method"><code id='from.v-30'>fn <a href='#method.from-29' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.i16.html">i16</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicI16.html" title="struct std::sync::atomic::AtomicI16">AtomicI16</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>i16</code> into an <code>AtomicI16</code>.</p>
</div></div><h3 id='impl-From%3Ci32%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i32.html">i32</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Ci32%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i32</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-30' class="method hidden"><code id='from.v-31'>fn <a href='#method.from-30' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i32.html">i32</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci32%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i32.html">i32</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Ci32%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i32</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-31' class="method hidden"><code id='from.v-32'>fn <a href='#method.from-31' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i32.html">i32</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci32%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i32.html">i32</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Ci32%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i32</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-32' class="method hidden"><code id='from.v-33'>fn <a href='#method.from-32' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i32.html">i32</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci32%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i32.html">i32</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicI32.html" title="struct std::sync::atomic::AtomicI32">AtomicI32</a></code><a href='#impl-From%3Ci32%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-33' class="method"><code id='from.v-34'>fn <a href='#method.from-33' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.i32.html">i32</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicI32.html" title="struct std::sync::atomic::AtomicI32">AtomicI32</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>i32</code> into an <code>AtomicI32</code>.</p>
</div></div><h3 id='impl-From%3Ci64%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i64.html">i64</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Ci64%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i64</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-34' class="method hidden"><code id='from.v-35'>fn <a href='#method.from-34' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i64.html">i64</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci64%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i64.html">i64</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicI64.html" title="struct std::sync::atomic::AtomicI64">AtomicI64</a></code><a href='#impl-From%3Ci64%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-35' class="method"><code id='from.v-36'>fn <a href='#method.from-35' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.i64.html">i64</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicI64.html" title="struct std::sync::atomic::AtomicI64">AtomicI64</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>i64</code> into an <code>AtomicI64</code>.</p>
</div></div><h3 id='impl-From%3Ci8%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.isize.html">isize</a></code><a href='#impl-From%3Ci8%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>isize</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-36' class="method hidden"><code id='from.v-37'>fn <a href='#method.from-36' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.isize.html">isize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.f32.html">f32</a></code><a href='#impl-From%3Ci8%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>f32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-37' class="method hidden"><code id='from.v-38'>fn <a href='#method.from-37' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.f32.html">f32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Ci8%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-38' class="method hidden"><code id='from.v-39'>fn <a href='#method.from-38' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Ci8%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-39' class="method hidden"><code id='from.v-40'>fn <a href='#method.from-39' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.i16.html">i16</a></code><a href='#impl-From%3Ci8%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>i16</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-40' class="method hidden"><code id='from.v-41'>fn <a href='#method.from-40' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.i16.html">i16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3Ci8%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>i32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-41' class="method hidden"><code id='from.v-42'>fn <a href='#method.from-41' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Ci8%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>i8</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-42' class="method hidden"><code id='from.v-43'>fn <a href='#method.from-42' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Ci8%3E-7' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.i8.html">i8</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicI8.html" title="struct std::sync::atomic::AtomicI8">AtomicI8</a></code><a href='#impl-From%3Ci8%3E-7' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-43' class="method"><code id='from.v-44'>fn <a href='#method.from-43' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.i8.html">i8</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicI8.html" title="struct std::sync::atomic::AtomicI8">AtomicI8</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>i8</code> into an <code>AtomicI8</code>.</p>
</div></div><h3 id='impl-From%3Cisize%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.isize.html">isize</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicIsize.html" title="struct std::sync::atomic::AtomicIsize">AtomicIsize</a></code><a href='#impl-From%3Cisize%3E' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-44' class="method"><code id='from.v-45'>fn <a href='#method.from-44' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.isize.html">isize</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicIsize.html" title="struct std::sync::atomic::AtomicIsize">AtomicIsize</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>isize</code> into an <code>AtomicIsize</code>.</p>
</div></div><h3 id='impl-From%3C!%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.never.html">!</a>&gt; for <a class="enum" href="../../std/convert/enum.Infallible.html" title="enum std::convert::Infallible">Infallible</a></code><a href='#impl-From%3C!%3E' class='anchor'></a><a class='srclink' href='../../src/core/convert.rs.html#705-709' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-45' class="method hidden"><code id='from.v-46'>fn <a href='#method.from-45' class='fnname'>from</a>(x: <a class="primitive" href="../primitive.never.html">!</a>) -&gt; <a class="enum" href="../../std/convert/enum.Infallible.html" title="enum std::convert::Infallible">Infallible</a></code><a class='srclink' href='../../src/core/convert.rs.html#706-708' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C!%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.never.html">!</a>&gt; for <a class="struct" href="../../std/num/struct.TryFromIntError.html" title="struct std::num::TryFromIntError">TryFromIntError</a></code><a href='#impl-From%3C!%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4439-4446' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-46' class="method hidden"><code id='from.v-47'>fn <a href='#method.from-46' class='fnname'>from</a>(never: <a class="primitive" href="../primitive.never.html">!</a>) -&gt; <a class="struct" href="../../std/num/struct.TryFromIntError.html" title="struct std::num::TryFromIntError">TryFromIntError</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4440-4445' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu128%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u128.html">u128</a>&gt; for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a href='#impl-From%3Cu128%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1415-1434' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-47' class="method"><code id='from.v-48'>fn <a href='#method.from-47' class='fnname'>from</a>(ip: <a class="primitive" href="../primitive.u128.html">u128</a>) -&gt; <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1431-1433' title='goto source code'>[src]</a></h4><div class='docblock'><p>Convert a host byte order <code>u128</code> into an <code>Ipv6Addr</code>.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>;

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv6Addr</span>::<span class="ident">from</span>(<span class="number">0x102030405060708090A0B0C0D0E0F00D_u128</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(
    <span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(
        <span class="number">0x1020</span>, <span class="number">0x3040</span>, <span class="number">0x5060</span>, <span class="number">0x7080</span>,
        <span class="number">0x90A0</span>, <span class="number">0xB0C0</span>, <span class="number">0xD0E0</span>, <span class="number">0xF00D</span>,
    ),
    <span class="ident">addr</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Alet%20addr%20%3D%20Ipv6Addr%3A%3Afrom(0x102030405060708090A0B0C0D0E0F00D_u128)%3B%0Aassert_eq!(%0A%20%20%20%20Ipv6Addr%3A%3Anew(%0A%20%20%20%20%20%20%20%200x1020%2C%200x3040%2C%200x5060%2C%200x7080%2C%0A%20%20%20%20%20%20%20%200x90A0%2C%200xB0C0%2C%200xD0E0%2C%200xF00D%2C%0A%20%20%20%20)%2C%0A%20%20%20%20addr)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cu16%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.usize.html">usize</a></code><a href='#impl-From%3Cu16%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>usize</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-48' class="method hidden"><code id='from.v-49'>fn <a href='#method.from-48' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.f32.html">f32</a></code><a href='#impl-From%3Cu16%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>f32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-49' class="method hidden"><code id='from.v-50'>fn <a href='#method.from-49' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.f32.html">f32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Cu16%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-50' class="method hidden"><code id='from.v-51'>fn <a href='#method.from-50' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Cu16%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-51' class="method hidden"><code id='from.v-52'>fn <a href='#method.from-51' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3Cu16%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>i32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-52' class="method hidden"><code id='from.v-53'>fn <a href='#method.from-52' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Cu16%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-53' class="method hidden"><code id='from.v-54'>fn <a href='#method.from-53' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3Cu16%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>u128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-54' class="method hidden"><code id='from.v-55'>fn <a href='#method.from-54' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-7' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3Cu16%3E-7' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>u32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-55' class="method hidden"><code id='from.v-56'>fn <a href='#method.from-55' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-8' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="primitive" href="../primitive.u64.html">u64</a></code><a href='#impl-From%3Cu16%3E-8' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u16</code> to <code>u64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-56' class="method hidden"><code id='from.v-57'>fn <a href='#method.from-56' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="primitive" href="../primitive.u64.html">u64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu16%3E-9' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u16.html">u16</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicU16.html" title="struct std::sync::atomic::AtomicU16">AtomicU16</a></code><a href='#impl-From%3Cu16%3E-9' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-57' class="method"><code id='from.v-58'>fn <a href='#method.from-57' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.u16.html">u16</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicU16.html" title="struct std::sync::atomic::AtomicU16">AtomicU16</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>u16</code> into an <code>AtomicU16</code>.</p>
</div></div><h3 id='impl-From%3Cu32%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Cu32%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u32</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-58' class="method hidden"><code id='from.v-59'>fn <a href='#method.from-58' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu32%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Cu32%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u32</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-59' class="method hidden"><code id='from.v-60'>fn <a href='#method.from-59' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu32%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Cu32%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u32</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-60' class="method hidden"><code id='from.v-61'>fn <a href='#method.from-60' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu32%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3Cu32%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u32</code> to <code>u128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-61' class="method hidden"><code id='from.v-62'>fn <a href='#method.from-61' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu32%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="primitive" href="../primitive.u64.html">u64</a></code><a href='#impl-From%3Cu32%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u32</code> to <code>u64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-62' class="method hidden"><code id='from.v-63'>fn <a href='#method.from-62' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="primitive" href="../primitive.u64.html">u64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu32%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a></code><a href='#impl-From%3Cu32%3E-5' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#803-817' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-63' class="method"><code id='from.v-64'>fn <a href='#method.from-63' class='fnname'>from</a>(ip: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#814-816' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a host byte order <code>u32</code> into an <code>Ipv4Addr</code>.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv4Addr</span>;

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv4Addr</span>::<span class="ident">from</span>(<span class="number">0x0d0c0b0au32</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">13</span>, <span class="number">12</span>, <span class="number">11</span>, <span class="number">10</span>), <span class="ident">addr</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv4Addr%3B%0A%0Alet%20addr%20%3D%20Ipv4Addr%3A%3Afrom(0x0d0c0b0au32)%3B%0Aassert_eq!(Ipv4Addr%3A%3Anew(13%2C%2012%2C%2011%2C%2010)%2C%20addr)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cu32%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u32.html">u32</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicU32.html" title="struct std::sync::atomic::AtomicU32">AtomicU32</a></code><a href='#impl-From%3Cu32%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-64' class="method"><code id='from.v-65'>fn <a href='#method.from-64' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.u32.html">u32</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicU32.html" title="struct std::sync::atomic::AtomicU32">AtomicU32</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>u32</code> into an <code>AtomicU32</code>.</p>
</div></div><h3 id='impl-From%3Cu64%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u64.html">u64</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Cu64%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u64</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-65' class="method hidden"><code id='from.v-66'>fn <a href='#method.from-65' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u64.html">u64</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu64%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u64.html">u64</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3Cu64%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u64</code> to <code>u128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-66' class="method hidden"><code id='from.v-67'>fn <a href='#method.from-66' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u64.html">u64</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu64%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u64.html">u64</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicU64.html" title="struct std::sync::atomic::AtomicU64">AtomicU64</a></code><a href='#impl-From%3Cu64%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-67' class="method"><code id='from.v-68'>fn <a href='#method.from-67' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.u64.html">u64</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicU64.html" title="struct std::sync::atomic::AtomicU64">AtomicU64</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>u64</code> into an <code>AtomicU64</code>.</p>
</div></div><h3 id='impl-From%3Cu8%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.usize.html">usize</a></code><a href='#impl-From%3Cu8%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>usize</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-68' class="method hidden"><code id='from.v-69'>fn <a href='#method.from-68' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.char.html">char</a></code><a href='#impl-From%3Cu8%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/char/convert.rs.html#144-162' title='goto source code'>[src]</a></h3><div class='docblock'><p>Maps a byte in 0x00...0xFF to a <code>char</code> whose code point has the same value, in U+0000 to U+00FF.</p>
<p>Unicode is designed such that this effectively decodes bytes
with the character encoding that IANA calls ISO-8859-1.
This encoding is compatible with ASCII.</p>
<p>Note that this is different from ISO/IEC 8859-1 a.k.a. ISO 8859-1 (with one less hyphen),
which leaves some &quot;blanks&quot;, byte values that are not assigned to any character.
ISO-8859-1 (the IANA one) assigns them to the C0 and C1 control codes.</p>
<p>Note that this is <em>also</em> different from Windows-1252 a.k.a. code page 1252,
which is a superset ISO/IEC 8859-1 that assigns some (not all!) blanks
to punctuation and various Latin characters.</p>
<p>To confuse things further, <a href="https://encoding.spec.whatwg.org/">on the Web</a>
<code>ascii</code>, <code>iso-8859-1</code>, and <code>windows-1252</code> are all aliases
for a superset of Windows-1252 that fills the remaining blanks with corresponding
C0 and C1 control codes.</p>
</div><div class='impl-items'><h4 id='method.from-69' class="method"><code id='from.v-70'>fn <a href='#method.from-69' class='fnname'>from</a>(i: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.char.html">char</a></code><a class='srclink' href='../../src/core/char/convert.rs.html#159-161' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/u8/index.html" title="`u8`"><code>u8</code></a> into a <a href="../../std/char/index.html" title="`char`"><code>char</code></a>.</p>
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">fn</span> <span class="ident">main</span>() {
    <span class="kw">let</span> <span class="ident">u</span> <span class="op">=</span> <span class="number">32</span> <span class="kw">as</span> <span class="ident">u8</span>;
    <span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">char</span>::<span class="ident">from</span>(<span class="ident">u</span>);
    <span class="macro">assert</span><span class="macro">!</span>(<span class="number">4</span> <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">c</span>))
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Ause%20std%3A%3Amem%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20u%20%3D%2032%20as%20u8%3B%0A%20%20%20%20let%20c%20%3D%20char%3A%3Afrom(u)%3B%0A%20%20%20%20assert!(4%20%3D%3D%20mem%3A%3Asize_of_val(%26c))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3Cu8%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.isize.html">isize</a></code><a href='#impl-From%3Cu8%3E-2' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>isize</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-70' class="method hidden"><code id='from.v-71'>fn <a href='#method.from-70' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.isize.html">isize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.f32.html">f32</a></code><a href='#impl-From%3Cu8%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>f32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-71' class="method hidden"><code id='from.v-72'>fn <a href='#method.from-71' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.f32.html">f32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.f64.html">f64</a></code><a href='#impl-From%3Cu8%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>f64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-72' class="method hidden"><code id='from.v-73'>fn <a href='#method.from-72' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.f64.html">f64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3Cu8%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>i128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-73' class="method hidden"><code id='from.v-74'>fn <a href='#method.from-73' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.i16.html">i16</a></code><a href='#impl-From%3Cu8%3E-6' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>i16</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-74' class="method hidden"><code id='from.v-75'>fn <a href='#method.from-74' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.i16.html">i16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-7' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3Cu8%3E-7' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>i32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-75' class="method hidden"><code id='from.v-76'>fn <a href='#method.from-75' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-8' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3Cu8%3E-8' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>i64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-76' class="method hidden"><code id='from.v-77'>fn <a href='#method.from-76' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-9' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3Cu8%3E-9' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>u128</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-77' class="method hidden"><code id='from.v-78'>fn <a href='#method.from-77' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-10' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.u16.html">u16</a></code><a href='#impl-From%3Cu8%3E-10' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>u16</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-78' class="method hidden"><code id='from.v-79'>fn <a href='#method.from-78' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.u16.html">u16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-11' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3Cu8%3E-11' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>u32</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-79' class="method hidden"><code id='from.v-80'>fn <a href='#method.from-79' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-12' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="primitive" href="../primitive.u64.html">u64</a></code><a href='#impl-From%3Cu8%3E-12' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#4838-4843' title='goto source code'>[src]</a></h3><div class='docblock'><p>Converts <code>u8</code> to <code>u64</code> losslessly.</p>
</div><div class='impl-items'><h4 id='method.from-80' class="method hidden"><code id='from.v-81'>fn <a href='#method.from-80' class='fnname'>from</a>(small: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="../primitive.u64.html">u64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#4840-4842' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3Cu8%3E-13' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicU8.html" title="struct std::sync::atomic::AtomicU8">AtomicU8</a></code><a href='#impl-From%3Cu8%3E-13' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-81' class="method"><code id='from.v-82'>fn <a href='#method.from-81' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.u8.html">u8</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicU8.html" title="struct std::sync::atomic::AtomicU8">AtomicU8</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>u8</code> into an <code>AtomicU8</code>.</p>
</div></div><h3 id='impl-From%3Cusize%3E' class='impl'><code class='in-band'>impl From&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicUsize.html" title="struct std::sync::atomic::AtomicUsize">AtomicUsize</a></code><a href='#impl-From%3Cusize%3E' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1185-1192' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-82' class="method"><code id='from.v-83'>fn <a href='#method.from-82' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.usize.html">usize</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicUsize.html" title="struct std::sync::atomic::AtomicUsize">AtomicUsize</a></code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>usize</code> into an <code>AtomicUsize</code>.</p>
</div></div><h3 id='impl-From%3CAllocErr%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/alloc/struct.AllocErr.html" title="struct std::alloc::AllocErr">AllocErr</a>&gt; for <a class="enum" href="../../std/collections/enum.CollectionAllocErr.html" title="enum std::collections::CollectionAllocErr">CollectionAllocErr</a></code><a href='#impl-From%3CAllocErr%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/mod.rs.html#58-63' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-83' class="method hidden"><code id='from.v-84'>fn <a href='#method.from-83' class='fnname'>from</a>(<a class="struct" href="../../std/alloc/struct.AllocErr.html" title="struct std::alloc::AllocErr">AllocErr</a>) -&gt; <a class="enum" href="../../std/collections/enum.CollectionAllocErr.html" title="enum std::collections::CollectionAllocErr">CollectionAllocErr</a></code><a class='srclink' href='../../src/alloc/collections/mod.rs.html#60-62' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CLayoutErr%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/alloc/struct.LayoutErr.html" title="struct std::alloc::LayoutErr">LayoutErr</a>&gt; for <a class="enum" href="../../std/collections/enum.CollectionAllocErr.html" title="enum std::collections::CollectionAllocErr">CollectionAllocErr</a></code><a href='#impl-From%3CLayoutErr%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/mod.rs.html#66-71' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-84' class="method hidden"><code id='from.v-85'>fn <a href='#method.from-84' class='fnname'>from</a>(<a class="struct" href="../../std/alloc/struct.LayoutErr.html" title="struct std::alloc::LayoutErr">LayoutErr</a>) -&gt; <a class="enum" href="../../std/collections/enum.CollectionAllocErr.html" title="enum std::collections::CollectionAllocErr">CollectionAllocErr</a></code><a class='srclink' href='../../src/alloc/collections/mod.rs.html#68-70' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CBox%3Cstr%3E%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a href='#impl-From%3CBox%3Cstr%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/boxed.rs.html#532-553' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-85' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-86'>fn <a href='#method.from-85' class='fnname'>from</a>(s: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/boxed.rs.html#550-552' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>Box&lt;str&gt;&gt;</code> into a <code>Box&lt;[u8]&gt;</code></p>
<p>This conversion does not allocate on the heap and happens in place.</p>
<h1 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// create a Box&lt;str&gt; which will be used to create a Box&lt;[u8]&gt;</span>
<span class="kw">let</span> <span class="ident">boxed</span>: <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="string">&quot;hello&quot;</span>);
<span class="kw">let</span> <span class="ident">boxed_str</span>: <span class="ident">Box</span><span class="op">&lt;</span>[<span class="ident">u8</span>]<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="ident">boxed</span>);

<span class="comment">// create a &amp;[u8] which will be used to create a Box&lt;[u8]&gt;</span>
<span class="kw">let</span> <span class="ident">slice</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">104</span>, <span class="number">101</span>, <span class="number">108</span>, <span class="number">108</span>, <span class="number">111</span>];
<span class="kw">let</span> <span class="ident">boxed_slice</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="ident">slice</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">boxed_slice</span>, <span class="ident">boxed_str</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%2F%2F%20create%20a%20Box%3Cstr%3E%20which%20will%20be%20used%20to%20create%20a%20Box%3C%5Bu8%5D%3E%0Afn%20main()%20%7B%0Alet%20boxed%3A%20Box%3Cstr%3E%20%3D%20Box%3A%3Afrom(%22hello%22)%3B%0Alet%20boxed_str%3A%20Box%3C%5Bu8%5D%3E%20%3D%20Box%3A%3Afrom(boxed)%3B%0A%0A%2F%2F%20create%20a%20%26%5Bu8%5D%20which%20will%20be%20used%20to%20create%20a%20Box%3C%5Bu8%5D%3E%0Alet%20slice%3A%20%26%5Bu8%5D%20%3D%20%26%5B104%2C%20101%2C%20108%2C%20108%2C%20111%5D%3B%0Alet%20boxed_slice%20%3D%20Box%3A%3Afrom(slice)%3B%0A%0Aassert_eq!(boxed_slice%2C%20boxed_str)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CBox%3Cstr%3E%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-From%3CBox%3Cstr%3E%3E-1' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2185-2203' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-86' class="method"><code id='from.v-87'>fn <a href='#method.from-86' class='fnname'>from</a>(s: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;) -&gt; <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a class='srclink' href='../../src/alloc/string.rs.html#2200-2202' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts the given boxed <code>str</code> slice to a <code>String</code>.
It is notable that the <code>str</code> slice is owned.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<p>Basic usage:</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s1</span>: <span class="ident">String</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;hello world&quot;</span>);
<span class="kw">let</span> <span class="ident">s2</span>: <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">s1</span>.<span class="ident">into_boxed_str</span>();
<span class="kw">let</span> <span class="ident">s3</span>: <span class="ident">String</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="ident">s2</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;hello world&quot;</span>, <span class="ident">s3</span>)<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20s1%3A%20String%20%3D%20String%3A%3Afrom(%22hello%20world%22)%3B%0Alet%20s2%3A%20Box%3Cstr%3E%20%3D%20s1.into_boxed_str()%3B%0Alet%20s3%3A%20String%20%3D%20String%3A%3Afrom(s2)%3B%0A%0Aassert_eq!(%22hello%20world%22%2C%20s3)%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CBox%3CCStr%3E%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;&gt; for <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a href='#impl-From%3CBox%3CCStr%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#701-710' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-87' class="method"><code id='from.v-88'>fn <a href='#method.from-87' class='fnname'>from</a>(s: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;) -&gt; <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#707-709' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../boxed/struct.Box.html"><code>Box</code></a><code>&lt;CStr&gt;</code> into a <a href="../ffi/struct.CString.html"><code>CString</code></a> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CBox%3COsStr%3E%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-From%3CBox%3COsStr%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#667-675' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-88' class="method"><code id='from.v-89'>fn <a href='#method.from-88' class='fnname'>from</a>(boxed: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;) -&gt; <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#672-674' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>Box&lt;OsStr&gt;</code> into a <code>OsString</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CBox%3CPath%3E%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a href='#impl-From%3CBox%3CPath%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1468-1475' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-89' class="method"><code id='from.v-90'>fn <a href='#method.from-89' class='fnname'>from</a>(boxed: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a class='srclink' href='../../src/std/path.rs.html#1472-1474' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>Box&lt;Path&gt;</code> into a <code>PathBuf</code></p>
<p>This conversion does not allocate or copy memory.</p>
</div></div><h3 id='impl-From%3CCString%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3CCString%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#721-730' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-90' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-91'>fn <a href='#method.from-90' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#727-729' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.CString.html"><code>CString</code></a> into a <a href="../boxed/struct.Box.html"><code>Box</code></a><code>&lt;CStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CCString%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3CCString%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#779-789' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-91' class="method"><code id='from.v-92'>fn <a href='#method.from-91' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#785-788' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.CString.html"><code>CString</code></a> into a <a href="../rc/struct.Rc.html"><code>Rc</code></a><code>&lt;CStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CCString%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3CCString%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#757-767' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-92' class="method"><code id='from.v-93'>fn <a href='#method.from-92' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#763-766' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.CString.html"><code>CString</code></a> into a <a href="../sync/struct.Arc.html"><code>Arc</code></a><code>&lt;CStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CCString%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a href='#impl-From%3CCString%3E-3' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#637-648' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-93' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-94'>fn <a href='#method.from-93' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#645-647' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.CString.html"><code>CString</code></a> into a <a href="../vec/struct.Vec.html"><code>Vec</code></a><code>&lt;u8&gt;</code>.</p>
<p>The conversion consumes the <a href="../ffi/struct.CString.html"><code>CString</code></a>, and removes the terminating NUL byte.</p>
</div></div><h3 id='impl-From%3CNulError%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.NulError.html" title="struct std::ffi::NulError">NulError</a>&gt; for <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a href='#impl-From%3CNulError%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#856-865' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-94' class="method"><code id='from.v-95'>fn <a href='#method.from-94' class='fnname'>from</a>(_: <a class="struct" href="../../std/ffi/struct.NulError.html" title="struct std::ffi::NulError">NulError</a>) -&gt; <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#861-864' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.NulError.html"><code>NulError</code></a> into a <a href="../io/struct.Error.html"><code>io::Error</code></a>.</p>
</div></div><h3 id='impl-From%3COsString%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3COsString%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#678-686' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-95' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-96'>fn <a href='#method.from-95' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#683-685' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.OsString.html"><code>OsString</code></a> into a <a href="../boxed/struct.Box.html"><code>Box</code></a><code>&lt;OsStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3COsString%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a href='#impl-From%3COsString%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1504-1511' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-96' class="method"><code id='from.v-97'>fn <a href='#method.from-96' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a class='srclink' href='../../src/std/path.rs.html#1508-1510' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>OsString</code> into a <code>PathBuf</code></p>
<p>This conversion does not allocate or copy memory.</p>
</div></div><h3 id='impl-From%3COsString%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3COsString%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#719-729' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-97' class="method"><code id='from.v-98'>fn <a href='#method.from-97' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#725-728' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.OsString.html"><code>OsString</code></a> into a <a href="../rc/struct.Rc.html"><code>Rc</code></a><code>&lt;OsStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3COsString%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3COsString%3E-3' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#697-707' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-98' class="method"><code id='from.v-99'>fn <a href='#method.from-98' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#703-706' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../ffi/struct.OsString.html"><code>OsString</code></a> into a <a href="../sync/struct.Arc.html"><code>Arc</code></a><code>&lt;OsStr&gt;</code> without copying or allocating.</p>
</div></div><h3 id='impl-From%3CFile%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>&gt; for <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a href='#impl-From%3CFile%3E' class='anchor'></a><a class='srclink' href='../../src/std/process.rs.html#1100-1124' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-99' class="method"><code id='from.v-100'>fn <a href='#method.from-99' class='fnname'>from</a>(file: <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>) -&gt; <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a class='srclink' href='../../src/std/process.rs.html#1121-1123' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>File</code> into a <code>Stdio</code></p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<p><code>File</code> will be converted to <code>Stdio</code> using <code>Stdio::from</code> under the hood.</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::<span class="ident">Command</span>;

<span class="comment">// With the `foo.txt` file containing `Hello, world!&quot;</span>
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">&quot;foo.txt&quot;</span>).<span class="ident">unwrap</span>();

<span class="kw">let</span> <span class="ident">reverse</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;rev&quot;</span>)
    .<span class="ident">stdin</span>(<span class="ident">file</span>)  <span class="comment">// Implicit File conversion into a Stdio</span>
    .<span class="ident">output</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed reverse command&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">reverse</span>.<span class="ident">stdout</span>, <span class="string">b&quot;!dlrow ,olleH&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aprocess%3A%3ACommand%3B%0A%0A%2F%2F%20With%20the%20%60foo.txt%60%20file%20containing%20%60Hello%2C%20world!%22%0Alet%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22).unwrap()%3B%0A%0Alet%20reverse%20%3D%20Command%3A%3Anew(%22rev%22)%0A%20%20%20%20.stdin(file)%20%20%2F%2F%20Implicit%20File%20conversion%20into%20a%20Stdio%0A%20%20%20%20.output()%0A%20%20%20%20.expect(%22failed%20reverse%20command%22)%3B%0A%0Aassert_eq!(reverse.stdout%2C%20b%22!dlrow%20%2ColleH%22)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CIpv4Addr%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a>&gt; for <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a href='#impl-From%3CIpv4Addr%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#670-674' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-100' class="method hidden"><code id='from.v-101'>fn <a href='#method.from-100' class='fnname'>from</a>(ipv4: <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a>) -&gt; <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#671-673' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CIpv4Addr%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3CIpv4Addr%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#785-800' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-101' class="method"><code id='from.v-102'>fn <a href='#method.from-101' class='fnname'>from</a>(ip: <a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#796-799' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>Ipv4Addr</code> into a host byte order <code>u32</code>.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv4Addr</span>;

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">13</span>, <span class="number">12</span>, <span class="number">11</span>, <span class="number">10</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x0d0c0b0au32</span>, <span class="ident">u32</span>::<span class="ident">from</span>(<span class="ident">addr</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv4Addr%3B%0A%0Alet%20addr%20%3D%20Ipv4Addr%3A%3Anew(13%2C%2012%2C%2011%2C%2010)%3B%0Aassert_eq!(0x0d0c0b0au32%2C%20u32%3A%3Afrom(addr))%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CIpv6Addr%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>&gt; for <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a href='#impl-From%3CIpv6Addr%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#677-681' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-102' class="method hidden"><code id='from.v-103'>fn <a href='#method.from-102' class='fnname'>from</a>(ipv6: <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>) -&gt; <a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#678-680' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CIpv6Addr%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3CIpv6Addr%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/net/ip.rs.html#1395-1413' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-103' class="method"><code id='from.v-104'>fn <a href='#method.from-103' class='fnname'>from</a>(ip: <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/std/net/ip.rs.html#1409-1412' title='goto source code'>[src]</a></h4><div class='docblock'><p>Convert an <code>Ipv6Addr</code> into a host byte order <code>u128</code>.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>;

<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(
    <span class="number">0x1020</span>, <span class="number">0x3040</span>, <span class="number">0x5060</span>, <span class="number">0x7080</span>,
    <span class="number">0x90A0</span>, <span class="number">0xB0C0</span>, <span class="number">0xD0E0</span>, <span class="number">0xF00D</span>,
);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x102030405060708090A0B0C0D0E0F00D_u128</span>, <span class="ident">u128</span>::<span class="ident">from</span>(<span class="ident">addr</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Alet%20addr%20%3D%20Ipv6Addr%3A%3Anew(%0A%20%20%20%200x1020%2C%200x3040%2C%200x5060%2C%200x7080%2C%0A%20%20%20%200x90A0%2C%200xB0C0%2C%200xD0E0%2C%200xF00D%2C%0A)%3B%0Aassert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128%2C%20u128%3A%3Afrom(addr))%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CSocketAddrV4%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.SocketAddrV4.html" title="struct std::net::SocketAddrV4">SocketAddrV4</a>&gt; for <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a href='#impl-From%3CSocketAddrV4%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/addr.rs.html#547-552' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-104' class="method"><code id='from.v-105'>fn <a href='#method.from-104' class='fnname'>from</a>(sock4: <a class="struct" href="../../std/net/struct.SocketAddrV4.html" title="struct std::net::SocketAddrV4">SocketAddrV4</a>) -&gt; <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a class='srclink' href='../../src/std/net/addr.rs.html#549-551' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/net/struct.SocketAddrV4.html" title="`SocketAddrV4`"><code>SocketAddrV4</code></a> into a <a href="../../std/net/enum.SocketAddr.html#V4.v" title="`SocketAddr::V4`"><code>SocketAddr::V4</code></a>.</p>
</div></div><h3 id='impl-From%3CSocketAddrV6%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/net/struct.SocketAddrV6.html" title="struct std::net::SocketAddrV6">SocketAddrV6</a>&gt; for <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a href='#impl-From%3CSocketAddrV6%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/addr.rs.html#555-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-105' class="method"><code id='from.v-106'>fn <a href='#method.from-105' class='fnname'>from</a>(sock6: <a class="struct" href="../../std/net/struct.SocketAddrV6.html" title="struct std::net::SocketAddrV6">SocketAddrV6</a>) -&gt; <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a class='srclink' href='../../src/std/net/addr.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/net/struct.SocketAddrV6.html" title="`SocketAddrV6`"><code>SocketAddrV6</code></a> into a <a href="../../std/net/enum.SocketAddr.html#V6.v" title="`SocketAddr::V6`"><code>SocketAddr::V6</code></a>.</p>
</div></div><h3 id='impl-From%3CNonZeroI128%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroI128.html" title="struct std::num::NonZeroI128">NonZeroI128</a>&gt; for <a class="primitive" href="../primitive.i128.html">i128</a></code><a href='#impl-From%3CNonZeroI128%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-106' class="method hidden"><code id='from.v-107'>fn <a href='#method.from-106' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroI128.html" title="struct std::num::NonZeroI128">NonZeroI128</a>) -&gt; <a class="primitive" href="../primitive.i128.html">i128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroI16%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroI16.html" title="struct std::num::NonZeroI16">NonZeroI16</a>&gt; for <a class="primitive" href="../primitive.i16.html">i16</a></code><a href='#impl-From%3CNonZeroI16%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-107' class="method hidden"><code id='from.v-108'>fn <a href='#method.from-107' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroI16.html" title="struct std::num::NonZeroI16">NonZeroI16</a>) -&gt; <a class="primitive" href="../primitive.i16.html">i16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroI32%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroI32.html" title="struct std::num::NonZeroI32">NonZeroI32</a>&gt; for <a class="primitive" href="../primitive.i32.html">i32</a></code><a href='#impl-From%3CNonZeroI32%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-108' class="method hidden"><code id='from.v-109'>fn <a href='#method.from-108' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroI32.html" title="struct std::num::NonZeroI32">NonZeroI32</a>) -&gt; <a class="primitive" href="../primitive.i32.html">i32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroI64%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroI64.html" title="struct std::num::NonZeroI64">NonZeroI64</a>&gt; for <a class="primitive" href="../primitive.i64.html">i64</a></code><a href='#impl-From%3CNonZeroI64%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-109' class="method hidden"><code id='from.v-110'>fn <a href='#method.from-109' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroI64.html" title="struct std::num::NonZeroI64">NonZeroI64</a>) -&gt; <a class="primitive" href="../primitive.i64.html">i64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroI8%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroI8.html" title="struct std::num::NonZeroI8">NonZeroI8</a>&gt; for <a class="primitive" href="../primitive.i8.html">i8</a></code><a href='#impl-From%3CNonZeroI8%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-110' class="method hidden"><code id='from.v-111'>fn <a href='#method.from-110' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroI8.html" title="struct std::num::NonZeroI8">NonZeroI8</a>) -&gt; <a class="primitive" href="../primitive.i8.html">i8</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroIsize%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroIsize.html" title="struct std::num::NonZeroIsize">NonZeroIsize</a>&gt; for <a class="primitive" href="../primitive.isize.html">isize</a></code><a href='#impl-From%3CNonZeroIsize%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-111' class="method hidden"><code id='from.v-112'>fn <a href='#method.from-111' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroIsize.html" title="struct std::num::NonZeroIsize">NonZeroIsize</a>) -&gt; <a class="primitive" href="../primitive.isize.html">isize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroU128%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroU128.html" title="struct std::num::NonZeroU128">NonZeroU128</a>&gt; for <a class="primitive" href="../primitive.u128.html">u128</a></code><a href='#impl-From%3CNonZeroU128%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-112' class="method hidden"><code id='from.v-113'>fn <a href='#method.from-112' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroU128.html" title="struct std::num::NonZeroU128">NonZeroU128</a>) -&gt; <a class="primitive" href="../primitive.u128.html">u128</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroU16%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroU16.html" title="struct std::num::NonZeroU16">NonZeroU16</a>&gt; for <a class="primitive" href="../primitive.u16.html">u16</a></code><a href='#impl-From%3CNonZeroU16%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-113' class="method hidden"><code id='from.v-114'>fn <a href='#method.from-113' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroU16.html" title="struct std::num::NonZeroU16">NonZeroU16</a>) -&gt; <a class="primitive" href="../primitive.u16.html">u16</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroU32%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroU32.html" title="struct std::num::NonZeroU32">NonZeroU32</a>&gt; for <a class="primitive" href="../primitive.u32.html">u32</a></code><a href='#impl-From%3CNonZeroU32%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-114' class="method hidden"><code id='from.v-115'>fn <a href='#method.from-114' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroU32.html" title="struct std::num::NonZeroU32">NonZeroU32</a>) -&gt; <a class="primitive" href="../primitive.u32.html">u32</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroU64%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroU64.html" title="struct std::num::NonZeroU64">NonZeroU64</a>&gt; for <a class="primitive" href="../primitive.u64.html">u64</a></code><a href='#impl-From%3CNonZeroU64%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-115' class="method hidden"><code id='from.v-116'>fn <a href='#method.from-115' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroU64.html" title="struct std::num::NonZeroU64">NonZeroU64</a>) -&gt; <a class="primitive" href="../primitive.u64.html">u64</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroU8%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroU8.html" title="struct std::num::NonZeroU8">NonZeroU8</a>&gt; for <a class="primitive" href="../primitive.u8.html">u8</a></code><a href='#impl-From%3CNonZeroU8%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-116' class="method hidden"><code id='from.v-117'>fn <a href='#method.from-116' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroU8.html" title="struct std::num::NonZeroU8">NonZeroU8</a>) -&gt; <a class="primitive" href="../primitive.u8.html">u8</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CNonZeroUsize%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/num/struct.NonZeroUsize.html" title="struct std::num::NonZeroUsize">NonZeroUsize</a>&gt; for <a class="primitive" href="../primitive.usize.html">usize</a></code><a href='#impl-From%3CNonZeroUsize%3E' class='anchor'></a><a class='srclink' href='../../src/core/num/mod.rs.html#87-91' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-117' class="method hidden"><code id='from.v-118'>fn <a href='#method.from-117' class='fnname'>from</a>(nonzero: <a class="struct" href="../../std/num/struct.NonZeroUsize.html" title="struct std::num::NonZeroUsize">NonZeroUsize</a>) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code><a class='srclink' href='../../src/core/num/mod.rs.html#88-90' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CPathBuf%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3CPathBuf%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1478-1486' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-118' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-119'>fn <a href='#method.from-118' class='fnname'>from</a>(p: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1483-1485' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>PathBuf</code> into a <code>Box&lt;Path&gt;</code></p>
<p>This conversion currently should not allocate memory,
but this behavior is not guaranteed on all platforms or in all future versions.</p>
</div></div><h3 id='impl-From%3CPathBuf%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-From%3CPathBuf%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1514-1521' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-119' class="method"><code id='from.v-120'>fn <a href='#method.from-119' class='fnname'>from</a>(path_buf: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a class='srclink' href='../../src/std/path.rs.html#1518-1520' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>PathBuf</code> into a <code>OsString</code></p>
<p>This conversion does not allocate or copy memory.</p>
</div></div><h3 id='impl-From%3CPathBuf%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3CPathBuf%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1641-1648' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-120' class="method"><code id='from.v-121'>fn <a href='#method.from-120' class='fnname'>from</a>(s: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1644-1647' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a Path into a Rc by copying the Path data into a new Rc buffer.</p>
</div></div><h3 id='impl-From%3CPathBuf%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3CPathBuf%3E-3' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1621-1628' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-121' class="method"><code id='from.v-122'>fn <a href='#method.from-121' class='fnname'>from</a>(s: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1624-1627' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a Path into a Rc by copying the Path data into a new Rc buffer.</p>
</div></div><h3 id='impl-From%3CChildStderr%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/process/struct.ChildStderr.html" title="struct std::process::ChildStderr">ChildStderr</a>&gt; for <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a href='#impl-From%3CChildStderr%3E' class='anchor'></a><a class='srclink' href='../../src/std/process.rs.html#1069-1097' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-122' class="method"><code id='from.v-123'>fn <a href='#method.from-122' class='fnname'>from</a>(child: <a class="struct" href="../../std/process/struct.ChildStderr.html" title="struct std::process::ChildStderr">ChildStderr</a>) -&gt; <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a class='srclink' href='../../src/std/process.rs.html#1094-1096' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>ChildStderr</code> into a <code>Stdio</code></p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::{<span class="ident">Command</span>, <span class="ident">Stdio</span>};

<span class="kw">let</span> <span class="ident">reverse</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;rev&quot;</span>)
    .<span class="ident">arg</span>(<span class="string">&quot;non_existing_file.txt&quot;</span>)
    .<span class="ident">stderr</span>(<span class="ident">Stdio</span>::<span class="ident">piped</span>())
    .<span class="ident">spawn</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed reverse command&quot;</span>);

<span class="kw">let</span> <span class="ident">cat</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;cat&quot;</span>)
    .<span class="ident">arg</span>(<span class="string">&quot;-&quot;</span>)
    .<span class="ident">stdin</span>(<span class="ident">reverse</span>.<span class="ident">stderr</span>.<span class="ident">unwrap</span>()) <span class="comment">// Converted into a Stdio here</span>
    .<span class="ident">output</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed echo command&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(
    <span class="ident">String</span>::<span class="ident">from_utf8_lossy</span>(<span class="kw-2">&amp;</span><span class="ident">cat</span>.<span class="ident">stdout</span>),
    <span class="string">&quot;rev: cannot open non_existing_file.txt: No such file or directory\n&quot;</span>
);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aprocess%3A%3A%7BCommand%2C%20Stdio%7D%3B%0A%0Alet%20reverse%20%3D%20Command%3A%3Anew(%22rev%22)%0A%20%20%20%20.arg(%22non_existing_file.txt%22)%0A%20%20%20%20.stderr(Stdio%3A%3Apiped())%0A%20%20%20%20.spawn()%0A%20%20%20%20.expect(%22failed%20reverse%20command%22)%3B%0A%0Alet%20cat%20%3D%20Command%3A%3Anew(%22cat%22)%0A%20%20%20%20.arg(%22-%22)%0A%20%20%20%20.stdin(reverse.stderr.unwrap())%20%2F%2F%20Converted%20into%20a%20Stdio%20here%0A%20%20%20%20.output()%0A%20%20%20%20.expect(%22failed%20echo%20command%22)%3B%0A%0Aassert_eq!(%0A%20%20%20%20String%3A%3Afrom_utf8_lossy(%26cat.stdout)%2C%0A%20%20%20%20%22rev%3A%20cannot%20open%20non_existing_file.txt%3A%20No%20such%20file%20or%20directory%5Cn%22%0A)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CChildStdin%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/process/struct.ChildStdin.html" title="struct std::process::ChildStdin">ChildStdin</a>&gt; for <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a href='#impl-From%3CChildStdin%3E' class='anchor'></a><a class='srclink' href='../../src/std/process.rs.html#1011-1037' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-123' class="method"><code id='from.v-124'>fn <a href='#method.from-123' class='fnname'>from</a>(child: <a class="struct" href="../../std/process/struct.ChildStdin.html" title="struct std::process::ChildStdin">ChildStdin</a>) -&gt; <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a class='srclink' href='../../src/std/process.rs.html#1034-1036' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>ChildStdin</code> into a <code>Stdio</code></p>
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
<p><code>ChildStdin</code> will be converted to <code>Stdio</code> using <code>Stdio::from</code> under the hood.</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::{<span class="ident">Command</span>, <span class="ident">Stdio</span>};

<span class="kw">let</span> <span class="ident">reverse</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;rev&quot;</span>)
    .<span class="ident">stdin</span>(<span class="ident">Stdio</span>::<span class="ident">piped</span>())
    .<span class="ident">spawn</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed reverse command&quot;</span>);

<span class="kw">let</span> <span class="ident">_echo</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;echo&quot;</span>)
    .<span class="ident">arg</span>(<span class="string">&quot;Hello, world!&quot;</span>)
    .<span class="ident">stdout</span>(<span class="ident">reverse</span>.<span class="ident">stdin</span>.<span class="ident">unwrap</span>()) <span class="comment">// Converted into a Stdio here</span>
    .<span class="ident">output</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed echo command&quot;</span>);

<span class="comment">// &quot;!dlrow ,olleH&quot; echoed to console</span><a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aprocess%3A%3A%7BCommand%2C%20Stdio%7D%3B%0A%0Alet%20reverse%20%3D%20Command%3A%3Anew(%22rev%22)%0A%20%20%20%20.stdin(Stdio%3A%3Apiped())%0A%20%20%20%20.spawn()%0A%20%20%20%20.expect(%22failed%20reverse%20command%22)%3B%0A%0Alet%20_echo%20%3D%20Command%3A%3Anew(%22echo%22)%0A%20%20%20%20.arg(%22Hello%2C%20world!%22)%0A%20%20%20%20.stdout(reverse.stdin.unwrap())%20%2F%2F%20Converted%20into%20a%20Stdio%20here%0A%20%20%20%20.output()%0A%20%20%20%20.expect(%22failed%20echo%20command%22)%3B%0A%0A%2F%2F%20%22!dlrow%20%2ColleH%22%20echoed%20to%20console%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CChildStdout%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/process/struct.ChildStdout.html" title="struct std::process::ChildStdout">ChildStdout</a>&gt; for <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a href='#impl-From%3CChildStdout%3E' class='anchor'></a><a class='srclink' href='../../src/std/process.rs.html#1040-1066' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-124' class="method"><code id='from.v-125'>fn <a href='#method.from-124' class='fnname'>from</a>(child: <a class="struct" href="../../std/process/struct.ChildStdout.html" title="struct std::process::ChildStdout">ChildStdout</a>) -&gt; <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a class='srclink' href='../../src/std/process.rs.html#1063-1065' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>ChildStdout</code> into a <code>Stdio</code></p>
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
<p><code>ChildStdout</code> will be converted to <code>Stdio</code> using <code>Stdio::from</code> under the hood.</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::{<span class="ident">Command</span>, <span class="ident">Stdio</span>};

<span class="kw">let</span> <span class="ident">hello</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;echo&quot;</span>)
    .<span class="ident">arg</span>(<span class="string">&quot;Hello, world!&quot;</span>)
    .<span class="ident">stdout</span>(<span class="ident">Stdio</span>::<span class="ident">piped</span>())
    .<span class="ident">spawn</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed echo command&quot;</span>);

<span class="kw">let</span> <span class="ident">reverse</span> <span class="op">=</span> <span class="ident">Command</span>::<span class="ident">new</span>(<span class="string">&quot;rev&quot;</span>)
    .<span class="ident">stdin</span>(<span class="ident">hello</span>.<span class="ident">stdout</span>.<span class="ident">unwrap</span>())  <span class="comment">// Converted into a Stdio here</span>
    .<span class="ident">output</span>()
    .<span class="ident">expect</span>(<span class="string">&quot;failed reverse command&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">reverse</span>.<span class="ident">stdout</span>, <span class="string">b&quot;!dlrow ,olleH\n&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aprocess%3A%3A%7BCommand%2C%20Stdio%7D%3B%0A%0Alet%20hello%20%3D%20Command%3A%3Anew(%22echo%22)%0A%20%20%20%20.arg(%22Hello%2C%20world!%22)%0A%20%20%20%20.stdout(Stdio%3A%3Apiped())%0A%20%20%20%20.spawn()%0A%20%20%20%20.expect(%22failed%20echo%20command%22)%3B%0A%0Alet%20reverse%20%3D%20Command%3A%3Anew(%22rev%22)%0A%20%20%20%20.stdin(hello.stdout.unwrap())%20%20%2F%2F%20Converted%20into%20a%20Stdio%20here%0A%20%20%20%20.output()%0A%20%20%20%20.expect(%22failed%20reverse%20command%22)%3B%0A%0Aassert_eq!(reverse.stdout%2C%20b%22!dlrow%20%2ColleH%5Cn%22)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CString%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3CString%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2206-2223' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-125' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-126'>fn <a href='#method.from-125' class='fnname'>from</a>(s: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/string.rs.html#2220-2222' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts the given <code>String</code> to a boxed <code>str</code> slice that is owned.</p>
<h1 id="examples-31" class="section-header"><a href="#examples-31">Examples</a></h1>
<p>Basic usage:</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s1</span>: <span class="ident">String</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;hello world&quot;</span>);
<span class="kw">let</span> <span class="ident">s2</span>: <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="ident">s1</span>);
<span class="kw">let</span> <span class="ident">s3</span>: <span class="ident">String</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="ident">s2</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;hello world&quot;</span>, <span class="ident">s3</span>)<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20s1%3A%20String%20%3D%20String%3A%3Afrom(%22hello%20world%22)%3B%0Alet%20s2%3A%20Box%3Cstr%3E%20%3D%20Box%3A%3Afrom(s1)%3B%0Alet%20s3%3A%20String%20%3D%20String%3A%3Afrom(s2)%3B%0A%0Aassert_eq!(%22hello%20world%22%2C%20s3)%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CString%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a>&gt;</code><a href='#impl-From%3CString%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#288-318' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-126' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-127'>fn <a href='#method.from-126' class='fnname'>from</a>(err: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a>&gt;</code><a class='srclink' href='../../src/std/error.rs.html#302-317' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/string/struct.String.html" title="`String`"><code>String</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> + <a href="../../std/marker/trait.Send.html" title="`Send`"><code>Send</code></a> + <a href="../../std/marker/trait.Sync.html" title="`Sync`"><code>Sync</code></a>.</p>
<h1 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">let</span> <span class="ident">a_string_error</span> <span class="op">=</span> <span class="string">&quot;a string error&quot;</span>.<span class="ident">to_string</span>();
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_string_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(
    <span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0A%0Alet%20a_string_error%20%3D%20%22a%20string%20error%22.to_string()%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%20%2B%20Send%20%2B%20Sync%3E%3A%3Afrom(a_string_error)%3B%0Aassert!(%0A%20%20%20%20mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%20%2B%20Send%20%2B%20Sync%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CString%3E-2' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a href='#impl-From%3CString%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#321-339' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-127' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-128'>fn <a href='#method.from-127' class='fnname'>from</a>(str_err: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a class='srclink' href='../../src/std/error.rs.html#334-338' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/string/struct.String.html" title="`String`"><code>String</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a>.</p>
<h1 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">let</span> <span class="ident">a_string_error</span> <span class="op">=</span> <span class="string">&quot;a string error&quot;</span>.<span class="ident">to_string</span>();
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_string_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0A%0Alet%20a_string_error%20%3D%20%22a%20string%20error%22.to_string()%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%3E%3A%3Afrom(a_string_error)%3B%0Aassert!(mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CString%3E-3' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-From%3CString%3E-3' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#350-357' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-128' class="method"><code id='from.v-129'>fn <a href='#method.from-128' class='fnname'>from</a>(s: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#354-356' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/string/struct.String.html" title="`String`"><code>String</code></a> into a <a href="../../std/ffi/struct.OsString.html" title="`OsString`"><code>OsString</code></a>.</p>
<p>The conversion copies the data, and includes an allocation on the heap.</p>
</div></div><h3 id='impl-From%3CString%3E-4' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a href='#impl-From%3CString%3E-4' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1524-1531' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-129' class="method"><code id='from.v-130'>fn <a href='#method.from-129' class='fnname'>from</a>(s: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a class='srclink' href='../../src/std/path.rs.html#1528-1530' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>String</code> into a <code>PathBuf</code></p>
<p>This conversion does not allocate or copy memory.</p>
</div></div><h3 id='impl-From%3CString%3E-5' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3CString%3E-5' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1165-1170' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-130' class="method hidden"><code id='from.v-131'>fn <a href='#method.from-130' class='fnname'>from</a>(v: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1167-1169' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CString%3E-6' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3CString%3E-6' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1619-1624' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-131' class="method hidden"><code id='from.v-132'>fn <a href='#method.from-131' class='fnname'>from</a>(v: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1621-1623' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CString%3E-7' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a href='#impl-From%3CString%3E-7' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2278-2296' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-132' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-133'>fn <a href='#method.from-132' class='fnname'>from</a>(string: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a class='srclink' href='../../src/alloc/string.rs.html#2293-2295' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts the given <code>String</code> to a vector <code>Vec</code> that holds values of type <code>u8</code>.</p>
<h1 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h1>
<p>Basic usage:</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s1</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;hello world&quot;</span>);
<span class="kw">let</span> <span class="ident">v1</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">from</span>(<span class="ident">s1</span>);

<span class="kw">for</span> <span class="ident">b</span> <span class="kw">in</span> <span class="ident">v1</span> {
    <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">b</span>);
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20s1%20%3D%20String%3A%3Afrom(%22hello%20world%22)%3B%0Alet%20v1%20%3D%20Vec%3A%3Afrom(s1)%3B%0A%0Afor%20b%20in%20v1%20%7B%0A%20%20%20%20println!(%22%7B%7D%22%2C%20b)%3B%0A%7D%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CRecvError%3E' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/sync/mpsc/struct.RecvError.html" title="struct std::sync::mpsc::RecvError">RecvError</a>&gt; for <a class="enum" href="../../std/sync/mpsc/enum.RecvTimeoutError.html" title="enum std::sync::mpsc::RecvTimeoutError">RecvTimeoutError</a></code><a href='#impl-From%3CRecvError%3E' class='anchor'></a><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1815-1821' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-133' class="method hidden"><code id='from.v-134'>fn <a href='#method.from-133' class='fnname'>from</a>(err: <a class="struct" href="../../std/sync/mpsc/struct.RecvError.html" title="struct std::sync::mpsc::RecvError">RecvError</a>) -&gt; <a class="enum" href="../../std/sync/mpsc/enum.RecvTimeoutError.html" title="enum std::sync::mpsc::RecvTimeoutError">RecvTimeoutError</a></code><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1816-1820' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CRecvError%3E-1' class='impl'><code class='in-band'>impl From&lt;<a class="struct" href="../../std/sync/mpsc/struct.RecvError.html" title="struct std::sync::mpsc::RecvError">RecvError</a>&gt; for <a class="enum" href="../../std/sync/mpsc/enum.TryRecvError.html" title="enum std::sync::mpsc::TryRecvError">TryRecvError</a></code><a href='#impl-From%3CRecvError%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1774-1780' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-134' class="method hidden"><code id='from.v-135'>fn <a href='#method.from-134' class='fnname'>from</a>(err: <a class="struct" href="../../std/sync/mpsc/struct.RecvError.html" title="struct std::sync::mpsc::RecvError">RecvError</a>) -&gt; <a class="enum" href="../../std/sync/mpsc/enum.TryRecvError.html" title="enum std::sync::mpsc::TryRecvError">TryRecvError</a></code><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1775-1779' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20str%3E' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27_%20str%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/boxed.rs.html#514-529' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-135' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-136'>fn <a href='#method.from-135' class='fnname'>from</a>(s: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/boxed.rs.html#526-528' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>&amp;str</code> into a <code>Box&lt;str&gt;</code></p>
<p>This conversion allocates on the heap
and performs a copy of <code>s</code>.</p>
<h1 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">boxed</span>: <span class="ident">Box</span><span class="op">&lt;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="string">&quot;hello&quot;</span>);
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">boxed</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20boxed%3A%20Box%3Cstr%3E%20%3D%20Box%3A%3Afrom(%22hello%22)%3B%0Aprintln!(%22%7B%7D%22%2C%20boxed)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%26%27_%20str%3E-1' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a href='#impl-From%3C%26%27_%20str%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#362-378' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-136' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-137'>fn <a href='#method.from-136' class='fnname'>from</a>(err: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a class='srclink' href='../../src/std/error.rs.html#375-377' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/str/index.html" title="`str`"><code>str</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a>.</p>
<h1 id="examples-36" class="section-header"><a href="#examples-36">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">let</span> <span class="ident">a_str_error</span> <span class="op">=</span> <span class="string">&quot;a str error&quot;</span>;
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_str_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0A%0Alet%20a_str_error%20%3D%20%22a%20str%20error%22%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%3E%3A%3Afrom(a_str_error)%3B%0Aassert!(mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%26%27_%20str%3E-2' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27_%20str%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1156-1162' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-137' class="method hidden"><code id='from.v-138'>fn <a href='#method.from-137' class='fnname'>from</a>(v: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1158-1161' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20str%3E-3' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-From%3C%26%27_%20str%3E-3' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2175-2180' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-138' class="method hidden"><code id='from.v-139'>fn <a href='#method.from-138' class='fnname'>from</a>(s: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a class='srclink' href='../../src/alloc/string.rs.html#2177-2179' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20str%3E-4' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27_%20str%3E-4' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1610-1616' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-139' class="method hidden"><code id='from.v-140'>fn <a href='#method.from-139' class='fnname'>from</a>(v: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1612-1615' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20str%3E-5' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a href='#impl-From%3C%26%27_%20str%3E-5' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2234-2238' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-140' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-141'>fn <a href='#method.from-140' class='fnname'>from</a>(s: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2235-2237' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20CStr%3E' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20CStr%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#693-698' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-141' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-142'>fn <a href='#method.from-141' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#694-697' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20CStr%3E-1' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a href='#impl-From%3C%26%27_%20CStr%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#1271-1275' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-142' class="method hidden"><code id='from.v-143'>fn <a href='#method.from-142' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#1272-1274' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20CStr%3E-2' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20CStr%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#792-798' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-143' class="method hidden"><code id='from.v-144'>fn <a href='#method.from-143' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#794-797' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20CStr%3E-3' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20CStr%3E-3' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#770-776' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-144' class="method hidden"><code id='from.v-145'>fn <a href='#method.from-144' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#772-775' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20OsStr%3E' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20OsStr%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#659-664' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-145' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-146'>fn <a href='#method.from-145' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#660-663' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20OsStr%3E-1' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20OsStr%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#732-738' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-146' class="method hidden"><code id='from.v-147'>fn <a href='#method.from-146' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#734-737' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20OsStr%3E-2' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27_%20OsStr%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#710-716' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-147' class="method hidden"><code id='from.v-148'>fn <a href='#method.from-147' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#712-715' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20Path%3E' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27_%20Path%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1459-1465' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-148' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-149'>fn <a href='#method.from-148' class='fnname'>from</a>(path: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1460-1464' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20Path%3E-1' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27_%20Path%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1651-1658' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-149' class="method"><code id='from.v-150'>fn <a href='#method.from-149' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1654-1657' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a Path into a Rc by copying the Path data into a new Rc buffer.</p>
</div></div><h3 id='impl-From%3C%26%27_%20Path%3E-2' class='impl'><code class='in-band'>impl&lt;'_&gt; From&lt;&amp;'_ <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27_%20Path%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1631-1638' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-150' class="method"><code id='from.v-151'>fn <a href='#method.from-150' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1634-1637' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a Path into a Rc by copying the Path data into a new Rc buffer.</p>
</div></div><h3 id='impl-From%3C%26%27_%20T%3E' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ </a>T&gt; for <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20T%3E' class='anchor'></a><a class='srclink' href='../../src/core/ptr.rs.html#3116-3121' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-151' class="method hidden"><code id='from.v-152'>fn <a href='#method.from-151' class='fnname'>from</a>(reference: <a class="primitive" href="../primitive.reference.html">&amp;</a>T) -&gt; <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/ptr.rs.html#3118-3120' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20mut%20T%3E' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>T&gt; for <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20mut%20T%3E' class='anchor'></a><a class='srclink' href='../../src/core/ptr.rs.html#3108-3113' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-152' class="method hidden"><code id='from.v-153'>fn <a href='#method.from-152' class='fnname'>from</a>(reference: <a class="primitive" href="../primitive.reference.html">&amp;mut </a>T) -&gt; <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/ptr.rs.html#3110-3112' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20%5BT%5D%3E' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'_ [T]</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20%5BT%5D%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/boxed.rs.html#492-511' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-153' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-154'>fn <a href='#method.from-153' class='fnname'>from</a>(slice: <a class="primitive" href="../primitive.slice.html">&amp;[T]</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/boxed.rs.html#506-510' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>&amp;[T]</code> into a <code>Box&lt;[T]&gt;</code></p>
<p>This conversion allocates on the heap
and performs a copy of <code>slice</code>.</p>
<h1 id="examples-37" class="section-header"><a href="#examples-37">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// create a &amp;[u8] which will be used to create a Box&lt;[u8]&gt;</span>
<span class="kw">let</span> <span class="ident">slice</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">104</span>, <span class="number">101</span>, <span class="number">108</span>, <span class="number">108</span>, <span class="number">111</span>];
<span class="kw">let</span> <span class="ident">boxed_slice</span>: <span class="ident">Box</span><span class="op">&lt;</span>[<span class="ident">u8</span>]<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">from</span>(<span class="ident">slice</span>);

<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">boxed_slice</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%2F%2F%20create%20a%20%26%5Bu8%5D%20which%20will%20be%20used%20to%20create%20a%20Box%3C%5Bu8%5D%3E%0Afn%20main()%20%7B%0Alet%20slice%3A%20%26%5Bu8%5D%20%3D%20%26%5B104%2C%20101%2C%20108%2C%20108%2C%20111%5D%3B%0Alet%20boxed_slice%3A%20Box%3C%5Bu8%5D%3E%20%3D%20Box%3A%3Afrom(slice)%3B%0A%0Aprintln!(%22%7B%3A%3F%7D%22%2C%20boxed_slice)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%26%27_%20%5BT%5D%3E-1' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'_ [T]</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20%5BT%5D%3E-1' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1148-1153' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-154' class="method hidden"><code id='from.v-155'>fn <a href='#method.from-154' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.slice.html">&amp;[T]</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1150-1152' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20%5BT%5D%3E-2' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'_ [T]</a>&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20%5BT%5D%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1602-1607' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-155' class="method hidden"><code id='from.v-156'>fn <a href='#method.from-155' class='fnname'>from</a>(v: <a class="primitive" href="../primitive.slice.html">&amp;[T]</a>) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1604-1606' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20%5BT%5D%3E-3' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'_ [T]</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20%5BT%5D%3E-3' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2185-2194' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-156' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-157'>fn <a href='#method.from-156' class='fnname'>from</a>(s: <a class="primitive" href="../primitive.slice.html">&amp;[T]</a>) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2187-2189' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20mut%20%5BT%5D%3E' class='impl'><code class='in-band'>impl&lt;'_, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'_ mut [T]</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27_%20mut%20%5BT%5D%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2197-2206' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-157' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-158'>fn <a href='#method.from-157' class='fnname'>from</a>(s: <a class="primitive" href="../primitive.slice.html">&amp;mut [T]</a>) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2199-2201' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20str%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27a%20str%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2233-2238' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-158' class="method hidden"><code id='from.v-159'>fn <a href='#method.from-158' class='fnname'>from</a>(s: &amp;'a <a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/string.rs.html#2235-2237' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20CStr%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20CStr%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#741-746' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-159' class="method hidden"><code id='from.v-160'>fn <a href='#method.from-159' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#743-745' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20CString%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20CString%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#749-754' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-160' class="method hidden"><code id='from.v-161'>fn <a href='#method.from-160' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#751-753' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20OsStr%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20OsStr%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#749-754' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-161' class="method hidden"><code id='from.v-162'>fn <a href='#method.from-161' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#751-753' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20OsString%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20OsString%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#757-762' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-162' class="method hidden"><code id='from.v-163'>fn <a href='#method.from-162' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#759-761' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20Path%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27a%20Path%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1589-1594' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-163' class="method hidden"><code id='from.v-164'>fn <a href='#method.from-163' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1591-1593' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20PathBuf%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27a%20PathBuf%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1605-1610' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-164' class="method hidden"><code id='from.v-165'>fn <a href='#method.from-164' class='fnname'>from</a>(p: &amp;'a <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1607-1609' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20String%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;&amp;'a <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27a%20String%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2249-2254' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-165' class="method hidden"><code id='from.v-166'>fn <a href='#method.from-165' class='fnname'>from</a>(s: &amp;'a <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/string.rs.html#2251-2253' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCow%3C%27a%2C%20str%3E%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a href='#impl-From%3CCow%3C%27a%2C%20str%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#402-419' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-166' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-167'>fn <a href='#method.from-166' class='fnname'>from</a>(err: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code><a class='srclink' href='../../src/std/error.rs.html#416-418' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/borrow/enum.Cow.html" title="`Cow`"><code>Cow</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a>.</p>
<h1 id="examples-38" class="section-header"><a href="#examples-38">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">borrow</span>::<span class="ident">Cow</span>;

<span class="kw">let</span> <span class="ident">a_cow_str_error</span> <span class="op">=</span> <span class="ident">Cow</span>::<span class="ident">from</span>(<span class="string">&quot;a str error&quot;</span>);
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_cow_str_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0Ause%20std%3A%3Aborrow%3A%3ACow%3B%0A%0Alet%20a_cow_str_error%20%3D%20Cow%3A%3Afrom(%22a%20str%20error%22)%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%3E%3A%3Afrom(a_cow_str_error)%3B%0Aassert!(mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CCow%3C%27a%2C%20str%3E%3E-1' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-From%3CCow%3C%27a%2C%20str%3E%3E-1' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2226-2230' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-167' class="method hidden"><code id='from.v-168'>fn <a href='#method.from-167' class='fnname'>from</a>(s: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;) -&gt; <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a class='srclink' href='../../src/alloc/string.rs.html#2227-2229' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCow%3C%27a%2C%20CStr%3E%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;&gt; for <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a href='#impl-From%3CCow%3C%27a%2C%20CStr%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#685-690' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-168' class="method hidden"><code id='from.v-169'>fn <a href='#method.from-168' class='fnname'>from</a>(s: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;) -&gt; Self</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#687-689' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCow%3C%27a%2C%20OsStr%3E%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-From%3CCow%3C%27a%2C%20OsStr%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#765-770' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-169' class="method hidden"><code id='from.v-170'>fn <a href='#method.from-169' class='fnname'>from</a>(s: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;) -&gt; Self</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#767-769' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCow%3C%27a%2C%20Path%3E%3E' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a href='#impl-From%3CCow%3C%27a%2C%20Path%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1613-1618' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-170' class="method hidden"><code id='from.v-171'>fn <a href='#method.from-170' class='fnname'>from</a>(p: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; Self</code><a class='srclink' href='../../src/std/path.rs.html#1615-1617' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCString%3E-4' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3CCString%3E-4' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#733-738' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-171' class="method hidden"><code id='from.v-172'>fn <a href='#method.from-171' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#735-737' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3COsString%3E-4' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3COsString%3E-4' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#741-746' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-172' class="method hidden"><code id='from.v-173'>fn <a href='#method.from-172' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#743-745' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CPathBuf%3E-4' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3CPathBuf%3E-4' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1597-1602' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-173' class="method hidden"><code id='from.v-174'>fn <a href='#method.from-173' class='fnname'>from</a>(s: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a class='srclink' href='../../src/std/path.rs.html#1599-1601' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CString%3E-8' class='impl'><code class='in-band'>impl&lt;'a&gt; From&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3CString%3E-8' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#2241-2246' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-174' class="method hidden"><code id='from.v-175'>fn <a href='#method.from-174' class='fnname'>from</a>(s: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a class='srclink' href='../../src/alloc/string.rs.html#2243-2245' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20str%3E-6' class='impl'><code class='in-band'>impl&lt;'a, '_&gt; From&lt;&amp;'_ <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a href='#impl-From%3C%26%27_%20str%3E-6' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#342-359' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-175' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-176'>fn <a href='#method.from-175' class='fnname'>from</a>(err: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a class='srclink' href='../../src/std/error.rs.html#356-358' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/str/index.html" title="`str`"><code>str</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> + <a href="../../std/marker/trait.Send.html" title="`Send`"><code>Send</code></a> + <a href="../../std/marker/trait.Sync.html" title="`Sync`"><code>Sync</code></a>.</p>
<h1 id="examples-39" class="section-header"><a href="#examples-39">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="kw">let</span> <span class="ident">a_str_error</span> <span class="op">=</span> <span class="string">&quot;a str error&quot;</span>;
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_str_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(
    <span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0A%0Alet%20a_str_error%20%3D%20%22a%20str%20error%22%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%20%2B%20Send%20%2B%20Sync%3E%3A%3Afrom(a_str_error)%3B%0Aassert!(%0A%20%20%20%20mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%20%2B%20Send%20%2B%20Sync%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CCow%3C%27b%2C%20str%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'b, <a class="primitive" href="../primitive.str.html">str</a>&gt;&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a href='#impl-From%3CCow%3C%27b%2C%20str%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#381-399' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-176' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-177'>fn <a href='#method.from-176' class='fnname'>from</a>(err: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'b, <a class="primitive" href="../primitive.str.html">str</a>&gt;) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a class='srclink' href='../../src/std/error.rs.html#396-398' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <a href="../../std/borrow/enum.Cow.html" title="`Cow`"><code>Cow</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> + <a href="../../std/marker/trait.Send.html" title="`Send`"><code>Send</code></a> + <a href="../../std/marker/trait.Sync.html" title="`Sync`"><code>Sync</code></a>.</p>
<h1 id="examples-40" class="section-header"><a href="#examples-40">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">borrow</span>::<span class="ident">Cow</span>;

<span class="kw">let</span> <span class="ident">a_cow_str_error</span> <span class="op">=</span> <span class="ident">Cow</span>::<span class="ident">from</span>(<span class="string">&quot;a str error&quot;</span>);
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">a_cow_str_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(
    <span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Amem%3B%0Ause%20std%3A%3Aborrow%3A%3ACow%3B%0A%0Alet%20a_cow_str_error%20%3D%20Cow%3A%3Afrom(%22a%20str%20error%22)%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%20%2B%20Send%20%2B%20Sync%3E%3A%3Afrom(a_cow_str_error)%3B%0Aassert!(%0A%20%20%20%20mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%20%2B%20Send%20%2B%20Sync%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CE%3E' class='impl'><code class='in-band'>impl&lt;'a, E:&nbsp;<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'a&gt; From&lt;E&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'a&gt;</code><a href='#impl-From%3CE%3E' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#210-243' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-177' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-178'>fn <a href='#method.from-177' class='fnname'>from</a>(err: E) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'a&gt;</code><a class='srclink' href='../../src/std/error.rs.html#240-242' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a type of <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a>.</p>
<h1 id="examples-41" class="section-header"><a href="#examples-41">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fmt</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span>
<span class="kw">struct</span> <span class="ident">AnError</span>;

<span class="kw">impl</span> <span class="ident">fmt</span>::<span class="ident">Display</span> <span class="kw">for</span> <span class="ident">AnError</span> {
    <span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">fmt</span>::<span class="ident">Formatter</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>) <span class="op">-&gt;</span> <span class="ident">fmt</span>::<span class="prelude-ty">Result</span> {
        <span class="macro">write</span><span class="macro">!</span>(<span class="ident">f</span> , <span class="string">&quot;An error&quot;</span>)
    }
}

<span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">AnError</span> {
    <span class="kw">fn</span> <span class="ident">description</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="kw-2">&amp;</span><span class="ident">str</span> {
        <span class="string">&quot;Description of an error&quot;</span>
    }
}

<span class="kw">let</span> <span class="ident">an_error</span> <span class="op">=</span> <span class="ident">AnError</span>;
<span class="macro">assert</span><span class="macro">!</span>(<span class="number">0</span> <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">an_error</span>));
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">an_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Afmt%3B%0Ause%20std%3A%3Amem%3B%0A%0A%23%5Bderive(Debug)%5D%0Astruct%20AnError%3B%0A%0Aimpl%20fmt%3A%3ADisplay%20for%20AnError%20%7B%0A%20%20%20%20fn%20fmt(%26self%2C%20f%3A%20%26mut%20fmt%3A%3AFormatter%3C'_%3E)%20-%3E%20fmt%3A%3AResult%20%7B%0A%20%20%20%20%20%20%20%20write!(f%20%2C%20%22An%20error%22)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Error%20for%20AnError%20%7B%0A%20%20%20%20fn%20description(%26self)%20-%3E%20%26str%20%7B%0A%20%20%20%20%20%20%20%20%22Description%20of%20an%20error%22%0A%20%20%20%20%7D%0A%7D%0A%0Alet%20an_error%20%3D%20AnError%3B%0Aassert!(0%20%3D%3D%20mem%3A%3Asize_of_val(%26an_error))%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%3E%3A%3Afrom(an_error)%3B%0Aassert!(mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CE%3E-1' class='impl'><code class='in-band'>impl&lt;'a, E:&nbsp;<a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt; From&lt;E&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a href='#impl-From%3CE%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/error.rs.html#246-285' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-178' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-179'>fn <a href='#method.from-178' class='fnname'>from</a>(err: E) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;dyn <a class="trait" href="../../std/error/trait.Error.html" title="trait std::error::Error">Error</a> + <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> + <a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> + 'a&gt;</code><a class='srclink' href='../../src/std/error.rs.html#282-284' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a type of <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> + <a href="../../std/marker/trait.Send.html" title="`Send`"><code>Send</code></a> + <a href="../../std/marker/trait.Sync.html" title="`Sync`"><code>Sync</code></a> into a box of dyn <a href="../../std/error/trait.Error.html" title="`Error`"><code>Error</code></a> +
<a href="../../std/marker/trait.Send.html" title="`Send`"><code>Send</code></a> + <a href="../../std/marker/trait.Sync.html" title="`Sync`"><code>Sync</code></a>.</p>
<h1 id="examples-42" class="section-header"><a href="#examples-42">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fmt</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;

<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span>
<span class="kw">struct</span> <span class="ident">AnError</span>;

<span class="kw">impl</span> <span class="ident">fmt</span>::<span class="ident">Display</span> <span class="kw">for</span> <span class="ident">AnError</span> {
    <span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">fmt</span>::<span class="ident">Formatter</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>) <span class="op">-&gt;</span> <span class="ident">fmt</span>::<span class="prelude-ty">Result</span> {
        <span class="macro">write</span><span class="macro">!</span>(<span class="ident">f</span> , <span class="string">&quot;An error&quot;</span>)
    }
}

<span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">AnError</span> {
    <span class="kw">fn</span> <span class="ident">description</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="kw-2">&amp;</span><span class="ident">str</span> {
        <span class="string">&quot;Description of an error&quot;</span>
    }
}

<span class="kw">unsafe</span> <span class="kw">impl</span> <span class="ident">Send</span> <span class="kw">for</span> <span class="ident">AnError</span> {}

<span class="kw">unsafe</span> <span class="kw">impl</span> <span class="ident">Sync</span> <span class="kw">for</span> <span class="ident">AnError</span> {}

<span class="kw">let</span> <span class="ident">an_error</span> <span class="op">=</span> <span class="ident">AnError</span>;
<span class="macro">assert</span><span class="macro">!</span>(<span class="number">0</span> <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">an_error</span>));
<span class="kw">let</span> <span class="ident">a_boxed_error</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="op">&lt;</span><span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;</span>::<span class="ident">from</span>(<span class="ident">an_error</span>);
<span class="macro">assert</span><span class="macro">!</span>(
    <span class="ident">mem</span>::<span class="ident">size_of</span>::<span class="op">&lt;</span><span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">&gt;&gt;</span>() <span class="op">==</span> <span class="ident">mem</span>::<span class="ident">size_of_val</span>(<span class="kw-2">&amp;</span><span class="ident">a_boxed_error</span>))<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aerror%3A%3AError%3B%0Ause%20std%3A%3Afmt%3B%0Ause%20std%3A%3Amem%3B%0A%0A%23%5Bderive(Debug)%5D%0Astruct%20AnError%3B%0A%0Aimpl%20fmt%3A%3ADisplay%20for%20AnError%20%7B%0A%20%20%20%20fn%20fmt(%26self%2C%20f%3A%20%26mut%20fmt%3A%3AFormatter%3C'_%3E)%20-%3E%20fmt%3A%3AResult%20%7B%0A%20%20%20%20%20%20%20%20write!(f%20%2C%20%22An%20error%22)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Error%20for%20AnError%20%7B%0A%20%20%20%20fn%20description(%26self)%20-%3E%20%26str%20%7B%0A%20%20%20%20%20%20%20%20%22Description%20of%20an%20error%22%0A%20%20%20%20%7D%0A%7D%0A%0Aunsafe%20impl%20Send%20for%20AnError%20%7B%7D%0A%0Aunsafe%20impl%20Sync%20for%20AnError%20%7B%7D%0A%0Alet%20an_error%20%3D%20AnError%3B%0Aassert!(0%20%3D%3D%20mem%3A%3Asize_of_val(%26an_error))%3B%0Alet%20a_boxed_error%20%3D%20Box%3A%3A%3CError%20%2B%20Send%20%2B%20Sync%3E%3A%3Afrom(an_error)%3B%0Aassert!(%0A%20%20%20%20mem%3A%3Asize_of%3A%3A%3CBox%3Cdyn%20Error%20%2B%20Send%20%2B%20Sync%3E%3E()%20%3D%3D%20mem%3A%3Asize_of_val(%26a_boxed_error))%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3C%26%27a%20Option%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;&amp;'a <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="primitive" href="../primitive.reference.html">&amp;'a </a>T&gt;</code><a href='#impl-From%3C%26%27a%20Option%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/core/option.rs.html#1100-1104' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-179' class="method hidden"><code id='from.v-180'>fn <a href='#method.from-179' class='fnname'>from</a>(o: &amp;'a <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="primitive" href="../primitive.reference.html">&amp;'a </a>T&gt;</code><a class='srclink' href='../../src/core/option.rs.html#1101-1103' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20Vec%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;&amp;'a <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27a%20Vec%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2259-2263' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-180' class="method hidden"><code id='from.v-181'>fn <a href='#method.from-180' class='fnname'>from</a>(v: &amp;'a <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2260-2262' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20mut%20Option%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;&amp;'a mut <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>T&gt;</code><a href='#impl-From%3C%26%27a%20mut%20Option%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/core/option.rs.html#1107-1111' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-181' class="method hidden"><code id='from.v-182'>fn <a href='#method.from-181' class='fnname'>from</a>(o: &amp;'a mut <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>T&gt;</code><a class='srclink' href='../../src/core/option.rs.html#1108-1110' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CCow%3C%27a%2C%20%5BT%5D%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>: <a class="trait" href="../../std/borrow/trait.ToOwned.html" title="trait std::borrow::ToOwned">ToOwned</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a> as <a class="trait" href="../../std/borrow/trait.ToOwned.html" title="trait std::borrow::ToOwned">ToOwned</a>&gt;::<a class="type" href="../../std/borrow/trait.ToOwned.html#associatedtype.Owned" title="type std::borrow::ToOwned::Owned">Owned</a> == <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-From%3CCow%3C%27a%2C%20%5BT%5D%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2209-2213' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-182' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-183'>fn <a href='#method.from-182' class='fnname'>from</a>(s: <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2210-2212' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27a%20%5BT%5D%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;<a class="primitive" href="../primitive.slice.html">&amp;'a [T]</a>&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3C%26%27a%20%5BT%5D%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2245-2249' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-183' class="method hidden"><code id='from.v-184'>fn <a href='#method.from-183' class='fnname'>from</a>(s: <a class="primitive" href="../primitive.slice.html">&amp;'a [T]</a>) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2246-2248' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;'a, T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-From%3CVec%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2252-2256' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-184' class="method hidden"><code id='from.v-185'>fn <a href='#method.from-184' class='fnname'>from</a>(v: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2253-2255' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C(I%2C%20u16)%3E' class='impl'><code class='in-band'>impl&lt;I:&nbsp;<a class="trait" href="../../std/convert/trait.Into.html" title="trait std::convert::Into">Into</a>&lt;<a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a>&gt;&gt; From&lt;<a class="primitive" href="../primitive.tuple.html">(</a>I, <a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.tuple.html">)</a>&gt; for <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a href='#impl-From%3C(I%2C%20u16)%3E' class='anchor'></a><a class='srclink' href='../../src/std/net/addr.rs.html#563-573' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-185' class="method"><code id='from.v-186'>fn <a href='#method.from-185' class='fnname'>from</a>(pieces: <a class="primitive" href="../primitive.tuple.html">(</a>I, <a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.tuple.html">)</a>) -&gt; <a class="enum" href="../../std/net/enum.SocketAddr.html" title="enum std::net::SocketAddr">SocketAddr</a></code><a class='srclink' href='../../src/std/net/addr.rs.html#570-572' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a tuple struct (Into&lt;<a href="../../std/net/enum.IpAddr.html" title="`IpAddr`"><code>IpAddr</code></a>&gt;, <code>u16</code>) into a <a href="../../std/net/enum.SocketAddr.html" title="`SocketAddr`"><code>SocketAddr</code></a>.</p>
<p>This conversion creates a <a href="../../std/net/enum.SocketAddr.html#V4.v" title="`SocketAddr::V4`"><code>SocketAddr::V4</code></a> for a <a href="../../std/net/enum.IpAddr.html#V4.v" title="`IpAddr::V4`"><code>IpAddr::V4</code></a>
and creates a <a href="../../std/net/enum.SocketAddr.html#V6.v" title="`SocketAddr::V6`"><code>SocketAddr::V6</code></a> for a <a href="../../std/net/enum.IpAddr.html#V6.v" title="`IpAddr::V6`"><code>IpAddr::V6</code></a>.</p>
<p><code>u16</code> is treated as port of the newly created <a href="../../std/net/enum.SocketAddr.html" title="`SocketAddr`"><code>SocketAddr</code></a>.</p>
</div></div><h3 id='impl-From%3C*mut%20T%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="primitive" href="../primitive.pointer.html">*mut T</a>&gt; for <a class="struct" href="../../std/sync/atomic/struct.AtomicPtr.html" title="struct std::sync::atomic::AtomicPtr">AtomicPtr</a>&lt;T&gt;</code><a href='#impl-From%3C*mut%20T%3E' class='anchor'></a><a class='srclink' href='../../src/core/sync/atomic.rs.html#1130-1133' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-186' class="method hidden"><code id='from.v-187'>fn <a href='#method.from-186' class='fnname'>from</a>(p: <a class="primitive" href="../primitive.pointer.html">*mut T</a>) -&gt; <a class="struct" href="../../std/sync/atomic/struct.AtomicPtr.html" title="struct std::sync::atomic::AtomicPtr">AtomicPtr</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/sync/atomic.rs.html#1132' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CBox%3C%5BT%5D%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a href='#impl-From%3CBox%3C%5BT%5D%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2218-2222' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-187' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-188'>fn <a href='#method.from-187' class='fnname'>from</a>(s: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2219-2221' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CBox%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/pin/struct.Pin.html" title="struct std::pin::Pin">Pin</a>&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3CBox%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/boxed.rs.html#482-489' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-188' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/pin/struct.Pin.html" title="struct std::pin::Pin">Pin</a>&lt;P&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/pin/struct.Pin.html" title="struct std::pin::Pin">Pin</a>&lt;P&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;P&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/pin/struct.Pin.html" title="struct std::pin::Pin">Pin</a>&lt;P&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/ops/trait.DerefMut.html" title="trait std::ops::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P as <a class="trait" href="../../std/ops/trait.Deref.html" title="trait std::ops::Deref">Deref</a>&gt;::<a class="type" href="../../std/ops/trait.Deref.html#associatedtype.Target" title="type std::ops::Deref::Target">Target</a>: <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;&lt;P as <a class="trait" href="../../std/ops/trait.Deref.html" title="trait std::ops::Deref">Deref</a>&gt;::<a class="type" href="../../std/ops/trait.Deref.html#associatedtype.Target" title="type std::ops::Deref::Target">Target</a> as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span></code></div></div><code id='from.v-189'>fn <a href='#method.from-188' class='fnname'>from</a>(boxed: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/pin/struct.Pin.html" title="struct std::pin::Pin">Pin</a>&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt;</code><a class='srclink' href='../../src/alloc/boxed.rs.html#486-488' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a <code>Box&lt;T&gt;</code> into a <code>Pin&lt;Box&lt;T&gt;&gt;</code></p>
<p>This conversion does not allocate on the heap and happens in place.</p>
</div></div><h3 id='impl-From%3CBox%3CT%3E%3E-1' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3CBox%3CT%3E%3E-1' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1173-1178' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-189' class="method hidden"><code id='from.v-190'>fn <a href='#method.from-189' class='fnname'>from</a>(v: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1175-1177' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CBox%3CT%3E%3E-2' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3CBox%3CT%3E%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1627-1632' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-190' class="method hidden"><code id='from.v-191'>fn <a href='#method.from-190' class='fnname'>from</a>(v: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1629-1631' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CBinaryHeap%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/collections/binary_heap/struct.BinaryHeap.html" title="struct std::collections::binary_heap::BinaryHeap">BinaryHeap</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a href='#impl-From%3CBinaryHeap%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/binary_heap.rs.html#1102-1106' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-191' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-192'>fn <a href='#method.from-191' class='fnname'>from</a>(heap: <a class="struct" href="../../std/collections/binary_heap/struct.BinaryHeap.html" title="struct std::collections::binary_heap::BinaryHeap">BinaryHeap</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/collections/binary_heap.rs.html#1103-1105' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVecDeque%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/collections/vec_deque/struct.VecDeque.html" title="struct std::collections::vec_deque::VecDeque">VecDeque</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a href='#impl-From%3CVecDeque%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2725-2793' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-192' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='from.v-193'>fn <a href='#method.from-192' class='fnname'>from</a>(other: <a class="struct" href="../../std/collections/vec_deque/struct.VecDeque.html" title="struct std::collections::vec_deque::VecDeque">VecDeque</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2726-2792' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CSendError%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/sync/mpsc/struct.SendError.html" title="struct std::sync::mpsc::SendError">SendError</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/sync/mpsc/enum.TrySendError.html" title="enum std::sync::mpsc::TrySendError">TrySendError</a>&lt;T&gt;</code><a href='#impl-From%3CSendError%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1713-1719' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-193' class="method hidden"><code id='from.v-194'>fn <a href='#method.from-193' class='fnname'>from</a>(err: <a class="struct" href="../../std/sync/mpsc/struct.SendError.html" title="struct std::sync::mpsc::SendError">SendError</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/sync/mpsc/enum.TrySendError.html" title="enum std::sync::mpsc::TrySendError">TrySendError</a>&lt;T&gt;</code><a class='srclink' href='../../src/std/sync/mpsc/mod.rs.html#1714-1718' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CPoisonError%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/sync/struct.PoisonError.html" title="struct std::sync::PoisonError">PoisonError</a>&lt;T&gt;&gt; for <a class="enum" href="../../std/sync/enum.TryLockError.html" title="enum std::sync::TryLockError">TryLockError</a>&lt;T&gt;</code><a href='#impl-From%3CPoisonError%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/sys_common/poison.rs.html#209-213' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-194' class="method hidden"><code id='from.v-195'>fn <a href='#method.from-194' class='fnname'>from</a>(err: <a class="struct" href="../../std/sync/struct.PoisonError.html" title="struct std::sync::PoisonError">PoisonError</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/sync/enum.TryLockError.html" title="enum std::sync::TryLockError">TryLockError</a>&lt;T&gt;</code><a class='srclink' href='../../src/std/sys_common/poison.rs.html#210-212' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E-1' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a href='#impl-From%3CVec%3CT%3E%3E-1' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#2227-2231' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-195' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-196'>fn <a href='#method.from-195' class='fnname'>from</a>(v: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/vec.rs.html#2228-2230' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E-2' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/collections/binary_heap/struct.BinaryHeap.html" title="struct std::collections::binary_heap::BinaryHeap">BinaryHeap</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a>,&nbsp;</span></code><a href='#impl-From%3CVec%3CT%3E%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/binary_heap.rs.html#1093-1099' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-196' class="method hidden"><code id='from.v-197'>fn <a href='#method.from-196' class='fnname'>from</a>(vec: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/collections/binary_heap/struct.BinaryHeap.html" title="struct std::collections::binary_heap::BinaryHeap">BinaryHeap</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/collections/binary_heap.rs.html#1094-1098' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E-3' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/collections/vec_deque/struct.VecDeque.html" title="struct std::collections::vec_deque::VecDeque">VecDeque</a>&lt;T&gt;</code><a href='#impl-From%3CVec%3CT%3E%3E-3' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2699-2722' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-197' class="method hidden"><code id='from.v-198'>fn <a href='#method.from-197' class='fnname'>from</a>(other: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/collections/vec_deque/struct.VecDeque.html" title="struct std::collections::vec_deque::VecDeque">VecDeque</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2700-2721' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E-4' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a href='#impl-From%3CVec%3CT%3E%3E-4' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1181-1193' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-198' class="method hidden"><code id='from.v-199'>fn <a href='#method.from-198' class='fnname'>from</a>(v: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1183-1192' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CVec%3CT%3E%3E-5' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a href='#impl-From%3CVec%3CT%3E%3E-5' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1635-1647' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-199' class="method hidden"><code id='from.v-200'>fn <a href='#method.from-199' class='fnname'>from</a>(v: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1637-1646' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='../../src/core/option.rs.html#1093-1097' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-200' class="method hidden"><code id='from.v-201'>fn <a href='#method.from-200' class='fnname'>from</a>(val: T) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/option.rs.html#1094-1096' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-1' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="enum" href="../../std/task/enum.Poll.html" title="enum std::task::Poll">Poll</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/task/poll.rs.html#75-79' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-201' class="method hidden"><code id='from.v-202'>fn <a href='#method.from-201' class='fnname'>from</a>(t: T) -&gt; <a class="enum" href="../../std/task/enum.Poll.html" title="enum std::task::Poll">Poll</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/task/poll.rs.html#76-78' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-2' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/boxed.rs.html#463-479' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-202' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;R&gt;</span><span class="where fmt-newline">impl&lt;W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;W&gt;</span></code></div></div><code id='from.v-203'>fn <a href='#method.from-202' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/boxed.rs.html#476-478' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts a generic type <code>T</code> into a <code>Box&lt;T&gt;</code></p>
<p>The conversion allocates on the heap and moves <code>t</code>
from the stack into it.</p>
<h1 id="examples-43" class="section-header"><a href="#examples-43">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="number">5</span>;
<span class="kw">let</span> <span class="ident">boxed</span> <span class="op">=</span> <span class="ident">Box</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Box</span>::<span class="ident">from</span>(<span class="ident">x</span>), <span class="ident">boxed</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Alet%20x%20%3D%205%3B%0Alet%20boxed%20%3D%20Box%3A%3Anew(5)%3B%0A%0Aassert_eq!(Box%3A%3Afrom(x)%2C%20boxed)%3B%0A%7D">Run</a></pre></div>
</div></div><h3 id='impl-From%3CT%3E-3' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-3' class='anchor'></a><a class='srclink' href='../../src/core/cell.rs.html#351-355' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-203' class="method hidden"><code id='from.v-204'>fn <a href='#method.from-203' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/cell.rs.html#352-354' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-4' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-4' class='anchor'></a><a class='srclink' href='../../src/core/cell.rs.html#1055-1059' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-204' class="method hidden"><code id='from.v-205'>fn <a href='#method.from-204' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/cell.rs.html#1056-1058' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-5' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/cell/struct.UnsafeCell.html" title="struct std::cell::UnsafeCell">UnsafeCell</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-5' class='anchor'></a><a class='srclink' href='../../src/core/cell.rs.html#1511-1515' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-205' class="method hidden"><code id='from.v-206'>fn <a href='#method.from-205' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/cell/struct.UnsafeCell.html" title="struct std::cell::UnsafeCell">UnsafeCell</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/cell.rs.html#1512-1514' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-6' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-6' class='anchor'></a><a class='srclink' href='../../src/alloc/rc.rs.html#1141-1145' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-206' class="method hidden"><code id='from.v-207'>fn <a href='#method.from-206' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/rc.rs.html#1142-1144' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-7' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-7' class='anchor'></a><a class='srclink' href='../../src/alloc/sync.rs.html#1595-1599' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-207' class="method hidden"><code id='from.v-208'>fn <a href='#method.from-207' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</a>&lt;T&gt;</code><a class='srclink' href='../../src/alloc/sync.rs.html#1596-1598' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CT%3E-8' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/sync/struct.Mutex.html" title="struct std::sync::Mutex">Mutex</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-8' class='anchor'></a><a class='srclink' href='../../src/std/sync/mutex.rs.html#376-382' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-208' class="method"><code id='from.v-209'>fn <a href='#method.from-208' class='fnname'>from</a>(t: T) -&gt; Self</code><a class='srclink' href='../../src/std/sync/mutex.rs.html#379-381' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new mutex in an unlocked state ready for use.
This is equivalent to <a href="../../std/sync/struct.Mutex.html#method.new" title="`Mutex::new`"><code>Mutex::new</code></a>.</p>
</div></div><h3 id='impl-From%3CT%3E-9' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for <a class="struct" href="../../std/sync/struct.RwLock.html" title="struct std::sync::RwLock">RwLock</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E-9' class='anchor'></a><a class='srclink' href='../../src/std/sync/rwlock.rs.html#453-459' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-209' class="method"><code id='from.v-210'>fn <a href='#method.from-209' class='fnname'>from</a>(t: T) -&gt; Self</code><a class='srclink' href='../../src/std/sync/rwlock.rs.html#456-458' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new instance of an <code>RwLock&lt;T&gt;</code> which is unlocked.
This is equivalent to <a href="../../std/sync/struct.RwLock.html#method.new" title="`RwLock::new`"><code>RwLock::new</code></a>.</p>
</div></div><h3 id='impl-From%3CT%3E-10' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;T&gt; for T</code><a href='#impl-From%3CT%3E-10' class='anchor'></a><a class='srclink' href='../../src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-210' class="method hidden"><code id='from.v-211'>fn <a href='#method.from-210' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='../../src/core/convert.rs.html#547' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CUnique%3CT%3E%3E' class='impl'><code class='in-band'>impl&lt;T&gt; From&lt;Unique&lt;T&gt;&gt; for <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-From%3CUnique%3CT%3E%3E' class='anchor'></a><a class='srclink' href='../../src/core/ptr.rs.html#3100-3105' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-211' class="method hidden"><code id='from.v-212'>fn <a href='#method.from-211' class='fnname'>from</a>(unique: Unique&lt;T&gt;) -&gt; <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a>&lt;T&gt;</code><a class='srclink' href='../../src/core/ptr.rs.html#3102-3104' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20T%3E-1' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a> + <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;, '_&gt; From&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ </a>T&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-From%3C%26%27_%20T%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#360-364' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-212' class="method hidden"><code id='from.v-213'>fn <a href='#method.from-212' class='fnname'>from</a>(s: <a class="primitive" href="../primitive.reference.html">&amp;</a>T) -&gt; <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#361-363' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3C%26%27_%20T%3E-2' class='impl'><code class='in-band'>impl&lt;T:&nbsp;?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a> + <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;, '_&gt; From&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ </a>T&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a href='#impl-From%3C%26%27_%20T%3E-2' class='anchor'></a><a class='srclink' href='../../src/std/path.rs.html#1497-1501' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-213' class="method hidden"><code id='from.v-214'>fn <a href='#method.from-213' class='fnname'>from</a>(s: <a class="primitive" href="../primitive.reference.html">&amp;</a>T) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><a class='srclink' href='../../src/std/path.rs.html#1498-1500' title='goto source code'>[src]</a></h4></div><h3 id='impl-From%3CIntoInnerError%3CW%3E%3E' class='impl'><code class='in-band'>impl&lt;W&gt; From&lt;<a class="struct" href="../../std/io/struct.IntoInnerError.html" title="struct std::io::IntoInnerError">IntoInnerError</a>&lt;W&gt;&gt; for <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a href='#impl-From%3CIntoInnerError%3CW%3E%3E' class='anchor'></a><a class='srclink' href='../../src/std/io/buffered.rs.html#729-731' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-214' class="method hidden"><code id='from.v-215'>fn <a href='#method.from-214' class='fnname'>from</a>(iie: <a class="struct" href="../../std/io/struct.IntoInnerError.html" title="struct std::io::IntoInnerError">IntoInnerError</a>&lt;W&gt;) -&gt; <a class="struct" href="../../std/io/struct.Error.html" title="struct std::io::Error">Error</a></code><a class='srclink' href='../../src/std/io/buffered.rs.html#730' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
                         src="../../implementors/core/convert/trait.From.js">
                 </script></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="../../main1.35.0.js"></script><script defer src="../../search-index.js"></script></body></html>