Now a REAL lib

This commit is contained in:
Justine
2023-01-09 19:23:20 +01:00
parent ef46613c71
commit fe9e6f04f5
19014 changed files with 715877 additions and 264 deletions

View File

@ -0,0 +1 @@
<!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="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location">Crate os_str_bytes</h2></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">List of all items</span></h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.EncodingError.html">EncodingError</a></li><li><a href="struct.RawOsStr.html">RawOsStr</a></li><li><a href="struct.RawOsString.html">RawOsString</a></li><li><a href="iter/struct.Split.html">iter::Split</a></li></ul><h3 id="Traits">Traits</h3><ul class="traits docblock"><li><a href="trait.OsStrBytes.html">OsStrBytes</a></li><li><a href="trait.OsStringBytes.html">OsStringBytes</a></li><li><a href="trait.Pattern.html">Pattern</a></li><li><a href="trait.RawOsStrCow.html">RawOsStrCow</a></li></ul></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

139
doc/os_str_bytes/index.html Normal file
View File

@ -0,0 +1,139 @@
<!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="This crate allows interacting with the data stored by [`OsStr`] and [`OsString`], without resorting to panics or corruption for invalid UTF-8. Thus, methods can be used that are already defined on [`[u8]`][slice] and [`Vec&lt;u8&gt;`]."><meta name="keywords" content="rust, rustlang, rust-lang, os_str_bytes"><title>os_str_bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate os_str_bytes</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 6.4.1</li><li><a id="all-types" href="all.html">All Items</a></li></ul></div><section><div class="block"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">os_str_bytes</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#1-623">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This crate allows interacting with the data stored by <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a> and
<a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsString.html" title="OsString"><code>OsString</code></a>, without resorting to panics or corruption for invalid UTF-8.
Thus, methods can be used that are already defined on <a href="https://doc.rust-lang.org/1.64.0/std/primitive.slice.html" title="slice"><code>[u8]</code></a> and
<a href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="Vec&lt;u8&gt;"><code>Vec&lt;u8&gt;</code></a>.</p>
<p>Typically, the only way to losslessly construct <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a> or <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsString.html" title="OsString"><code>OsString</code></a>
from a byte sequence is to use <code>OsStr::new(str::from_utf8(bytes)?)</code>, which
requires the bytes to be valid in UTF-8. However, since this crate makes
conversions directly between the platform encoding and raw bytes, even some
strings invalid in UTF-8 can be converted.</p>
<p>In most cases, <a href="struct.RawOsStr.html" title="RawOsStr"><code>RawOsStr</code></a> and <a href="struct.RawOsString.html" title="RawOsString"><code>RawOsString</code></a> should be used.
<a href="trait.OsStrBytes.html" title="OsStrBytes"><code>OsStrBytes</code></a> and <a href="trait.OsStringBytes.html" title="OsStringBytes"><code>OsStringBytes</code></a> provide lower-level APIs that are
easier to misuse.</p>
<h2 id="encoding"><a href="#encoding">Encoding</a></h2>
<p>The encoding of bytes returned or accepted by methods of this crate is
intentionally left unspecified. It may vary for different platforms, so
defining it would run contrary to the goal of generic string handling.
However, the following invariants will always be upheld:</p>
<ul>
<li>
<p>The encoding will be compatible with UTF-8. In particular, splitting an
encoded byte sequence by a UTF-8encoded character always produces
other valid byte sequences. They can be re-encoded without error using
<a href="struct.RawOsString.html#method.into_os_string" title="RawOsString::into_os_string"><code>RawOsString::into_os_string</code></a> and similar methods.</p>
</li>
<li>
<p>All characters valid in platform strings are representable. <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a> and
<a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsString.html" title="OsString"><code>OsString</code></a> can always be losslessly reconstructed from extracted bytes.</p>
</li>
</ul>
<p>Note that the chosen encoding may not match how Rust stores these strings
internally, which is undocumented. For instance, the result of calling
<a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html#method.len" title="OsStr::len"><code>OsStr::len</code></a> will not necessarily match the number of bytes this crate
uses to represent the same string.</p>
<p>Additionally, concatenation may yield unexpected results without a UTF-8
separator. If two platform strings need to be concatenated, the only safe
way to do so is using <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsString.html#method.push" title="OsString::push"><code>OsString::push</code></a>. This limitation also makes it
undesirable to use the bytes in interchange.</p>
<p>Since this encoding can change between versions and platforms, it should
not be used for storage. The standard library provides implementations of
<a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStrExt.html"><code>OsStrExt</code></a> and <a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStringExt.html"><code>OsStringExt</code></a> for various platforms, which should be
preferred for that use case.</p>
<h2 id="user-input"><a href="#user-input">User Input</a></h2>
<p>Traits in this crate should ideally not be used to convert byte sequences
that did not originate from <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a> or a related struct. The encoding
used by this crate is an implementation detail, so it does not make sense
to expose it to users.</p>
<p>Crate <a href="https://crates.io/crates/bstr">bstr</a> offers some useful alternative methods, such as
<a href="https://docs.rs/bstr/0.2.12/bstr/trait.ByteSlice.html#method.to_os_str"><code>ByteSlice::to_os_str</code></a> and <a href="https://docs.rs/bstr/0.2.12/bstr/trait.ByteVec.html#method.into_os_string"><code>ByteVec::into_os_string</code></a>, that are meant
for user input. But, they reject some byte sequences used to represent
valid platform strings, which would be undesirable for reliable path
handling. They are best used only when accepting unknown input.</p>
<p>This crate is meant to help when you already have an instance of <a href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a>
and need to modify the data in a lossless way.</p>
<h2 id="features"><a href="#features">Features</a></h2>
<p>These features are optional and can be enabled or disabled in a
“Cargo.toml” file.</p>
<h4 id="default-features"><a href="#default-features">Default Features</a></h4>
<ul>
<li>
<p><strong>memchr</strong> -
Changes the implementation to use crate <a href="https://crates.io/crates/memchr">memchr</a> for better performance.
This feature is useless when “raw_os_str” is disabled.</p>
<p>For more information, see <a href="struct.RawOsStr.html#complexity"><code>RawOsStr</code></a>.</p>
</li>
<li>
<p><strong>raw_os_str</strong> -
Provides:</p>
<ul>
<li><a href="iter/index.html" title="iter"><code>iter</code></a></li>
<li><a href="trait.Pattern.html" title="Pattern"><code>Pattern</code></a></li>
<li><a href="struct.RawOsStr.html" title="RawOsStr"><code>RawOsStr</code></a></li>
<li><a href="trait.RawOsStrCow.html" title="RawOsStrCow"><code>RawOsStrCow</code></a></li>
<li><a href="struct.RawOsString.html" title="RawOsString"><code>RawOsString</code></a></li>
</ul>
</li>
</ul>
<h4 id="optional-features"><a href="#optional-features">Optional Features</a></h4>
<ul>
<li>
<p><strong>checked_conversions</strong> -
Provides:</p>
<ul>
<li><a href="struct.EncodingError.html" title="EncodingError"><code>EncodingError</code></a></li>
<li><a href="trait.OsStrBytes.html#tymethod.from_raw_bytes" title="OsStrBytes::from_raw_bytes"><code>OsStrBytes::from_raw_bytes</code></a></li>
<li><a href="trait.OsStringBytes.html#tymethod.from_raw_vec" title="OsStringBytes::from_raw_vec"><code>OsStringBytes::from_raw_vec</code></a></li>
<li>[<code>RawOsStr::from_raw_bytes</code>]</li>
<li>[<code>RawOsString::from_raw_vec</code>]</li>
</ul>
<p>Because this feature should not be used in libraries, the
“OS_STR_BYTES_CHECKED_CONVERSIONS” environment variable must be defined
during compilation.</p>
</li>
<li>
<p><strong>print_bytes</strong> -
Provides implementations of [<code>print_bytes::ToBytes</code>] for <a href="struct.RawOsStr.html" title="RawOsStr"><code>RawOsStr</code></a> and
<a href="struct.RawOsString.html" title="RawOsString"><code>RawOsString</code></a>.</p>
</li>
<li>
<p><strong>uniquote</strong> -
Provides implementations of [<code>uniquote::Quote</code>] for <a href="struct.RawOsStr.html" title="RawOsStr"><code>RawOsStr</code></a> and
<a href="struct.RawOsString.html" title="RawOsString"><code>RawOsString</code></a>.</p>
</li>
</ul>
<h2 id="implementation"><a href="#implementation">Implementation</a></h2>
<p>Some methods return <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="Cow"><code>Cow</code></a> to account for platform differences. However,
no guarantee is made that the same variant of that enum will always be
returned for the same platform. Whichever can be constructed most
efficiently will be returned.</p>
<p>All traits are <a href="https://rust-lang.github.io/api-guidelines/future-proofing.html#c-sealed">sealed</a>, meaning that they can only be implemented by this
crate. Otherwise, backward compatibility would be more difficult to
maintain for new features.</p>
<h2 id="complexity"><a href="#complexity">Complexity</a></h2>
<p>Conversion method complexities will vary based on what functionality is
available for the platform. At worst, they will all be linear, but some can
take constant time. For example, <a href="struct.RawOsString.html#method.into_os_string" title="RawOsString::into_os_string"><code>RawOsString::into_os_string</code></a> might be
able to reuse its allocation.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">std::fs</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::RawOsStr</span>;
<span class="kw">for</span> <span class="ident">file</span> <span class="kw">in</span> <span class="ident">env::args_os</span>().<span class="ident">skip</span>(<span class="number">1</span>) {
<span class="kw">if</span> <span class="op">!</span><span class="ident">RawOsStr::new</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>).<span class="ident">starts_with</span>(<span class="string">&#39;-&#39;</span>) {
<span class="kw">let</span> <span class="ident">string</span> <span class="op">=</span> <span class="string">&quot;Hello, world!&quot;</span>;
<span class="ident">fs::write</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>, <span class="ident">string</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(<span class="ident">string</span>, <span class="ident">fs::read_to_string</span>(<span class="ident">file</span>)<span class="question-mark">?</span>);
}
}</code></pre></div>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="iter/index.html" title="os_str_bytes::iter mod">iter</a></div><div class="item-right docblock-short"><p>Iterators provided by this crate.</p>
</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.EncodingError.html" title="os_str_bytes::EncodingError struct">EncodingError</a><span class="stab deprecated" title="">Deprecated</span></div><div class="item-right docblock-short"><p>The error that occurs when a byte sequence is not representable in the
platform encoding.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.RawOsStr.html" title="os_str_bytes::RawOsStr struct">RawOsStr</a></div><div class="item-right docblock-short"><p>A container for borrowed byte strings converted by this crate.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.RawOsString.html" title="os_str_bytes::RawOsString struct">RawOsString</a></div><div class="item-right docblock-short"><p>A container for owned byte strings converted by this crate.</p>
</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.OsStrBytes.html" title="os_str_bytes::OsStrBytes trait">OsStrBytes</a></div><div class="item-right docblock-short"><p>A platform agnostic variant of <a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStrExt.html"><code>OsStrExt</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.OsStringBytes.html" title="os_str_bytes::OsStringBytes trait">OsStringBytes</a></div><div class="item-right docblock-short"><p>A platform agnostic variant of <a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStringExt.html"><code>OsStringExt</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Pattern.html" title="os_str_bytes::Pattern trait">Pattern</a></div><div class="item-right docblock-short"><p>Allows a type to be used for searching by <a href="struct.RawOsStr.html"><code>RawOsStr</code></a> and <a href="struct.RawOsString.html"><code>RawOsString</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.RawOsStrCow.html" title="os_str_bytes::RawOsStrCow trait">RawOsStrCow</a></div><div class="item-right docblock-short"><p>Extensions to <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html"><code>Cow&lt;RawOsStr&gt;</code></a> for additional conversions.</p>
</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

View File

@ -0,0 +1,3 @@
<!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="Iterators provided by this crate."><meta name="keywords" content="rust, rustlang, rust-lang, iter"><title>os_str_bytes::iter - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Module iter</a></h2><div class="sidebar-elems"><section><div class="block"><ul><li><a href="#structs">Structs</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../os_str_bytes/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">os_str_bytes</a>::<wbr><a class="mod" href="#">iter</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/os_str_bytes/iter.rs.html#1-111">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Iterators provided by this crate.</p>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Split.html" title="os_str_bytes::iter::Split struct">Split</a></div><div class="item-right docblock-short"><p>The iterator returned by <a href="../struct.RawOsStr.html#method.split" title="RawOsStr::split"><code>RawOsStr::split</code></a>.</p>
</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

View File

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":[["Split","The iterator returned by [`RawOsStr::split`]."]]};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../os_str_bytes/trait.Pattern.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../os_str_bytes/trait.Pattern.html">../../os_str_bytes/trait.Pattern.html</a>...</p>
<script>location.replace("../../os_str_bytes/trait.Pattern.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../os_str_bytes/struct.RawOsStr.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../os_str_bytes/struct.RawOsStr.html">../../os_str_bytes/struct.RawOsStr.html</a>...</p>
<script>location.replace("../../os_str_bytes/struct.RawOsStr.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../os_str_bytes/struct.RawOsString.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../os_str_bytes/struct.RawOsString.html">../../os_str_bytes/struct.RawOsString.html</a>...</p>
<script>location.replace("../../os_str_bytes/struct.RawOsString.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../os_str_bytes/trait.RawOsStrCow.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../os_str_bytes/trait.RawOsStrCow.html">../../os_str_bytes/trait.RawOsStrCow.html</a>...</p>
<script>location.replace("../../os_str_bytes/trait.RawOsStrCow.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"mod":[["iter","Iterators provided by this crate."]],"struct":[["EncodingError","The error that occurs when a byte sequence is not representable in the platform encoding."],["RawOsStr","A container for borrowed byte strings converted by this crate."],["RawOsString","A container for owned byte strings converted by this crate."]],"trait":[["OsStrBytes","A platform agnostic variant of `OsStrExt`."],["OsStringBytes","A platform agnostic variant of `OsStringExt`."],["Pattern","Allows a type to be used for searching by `RawOsStr` and `RawOsString`."],["RawOsStrCow","Extensions to `Cow<RawOsStr>` for additional conversions."]]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
<!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="A platform agnostic variant of `OsStrExt`."><meta name="keywords" content="rust, rustlang, rust-lang, OsStrBytes"><title>OsStrBytes in os_str_bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">OsStrBytes</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.assert_from_raw_bytes">assert_from_raw_bytes</a></li><li><a href="#tymethod.from_raw_bytes">from_raw_bytes</a></li><li><a href="#tymethod.to_raw_bytes">to_raw_bytes</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-OsStrBytes-for-OsStr">OsStr</a></li><li><a href="#impl-OsStrBytes-for-Path">Path</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In os_str_bytes</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">os_str_bytes</a>::<wbr><a class="trait" href="#">OsStrBytes</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#336-424">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait OsStrBytes: Sealed + <a class="trait" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> {
fn <a href="#tymethod.assert_from_raw_bytes" class="fnname">assert_from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.from_raw_bytes" class="fnname">from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt;, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.to_raw_bytes" class="fnname">to_raw_bytes</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'_, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;;
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A platform agnostic variant of <a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStrExt.html"><code>OsStrExt</code></a>.</p>
<p>For more information, see <a href="index.html">the module-level documentation</a>.</p>
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.assert_from_raw_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#363-365">source</a></div><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_bytes" class="fnname">assert_from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></div></summary><div class="docblock"><p>Converts a byte string into an equivalent platform-native string.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if the string is not valid for the <a href="index.html#encoding">unspecified encoding</a> used
by this crate.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">std::ffi::OsStr</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStrBytes</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">env::current_exe</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">os_bytes</span> <span class="op">=</span> <span class="ident">os_string</span>.<span class="ident">to_raw_bytes</span>();
<span class="macro">assert_eq!</span>(<span class="ident">os_string</span>, <span class="ident">OsStr::assert_from_raw_bytes</span>(<span class="ident">os_bytes</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.from_raw_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#400-402">source</a></div><h4 class="code-header">fn <a href="#tymethod.from_raw_bytes" class="fnname">from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt;, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></div></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_bytes</code> instead, or enable the checked_conversions feature</p>
</div></span><div class="docblock"><p>Converts a byte string into an equivalent platform-native string.</p>
<p><a href="trait.OsStrBytes.html#tymethod.assert_from_raw_bytes"><code>assert_from_raw_bytes</code></a> should almost always be used instead. For
more information, see <a href="struct.EncodingError.html" title="EncodingError"><code>EncodingError</code></a>.</p>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>See documentation for <a href="struct.EncodingError.html" title="EncodingError"><code>EncodingError</code></a>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">std::ffi::OsStr</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStrBytes</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">env::current_exe</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">os_bytes</span> <span class="op">=</span> <span class="ident">os_string</span>.<span class="ident">to_raw_bytes</span>();
<span class="macro">assert_eq!</span>(<span class="ident">os_string</span>, <span class="ident">OsStr::from_raw_bytes</span>(<span class="ident">os_bytes</span>).<span class="ident">unwrap</span>());</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.to_raw_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#423">source</a></div><h4 class="code-header">fn <a href="#tymethod.to_raw_bytes" class="fnname">to_raw_bytes</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'_, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;</h4></div></summary><div class="docblock"><p>Converts a platform-native string into an equivalent byte string.</p>
<p>The returned string will use an <a href="index.html#encoding">unspecified encoding</a>.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::ffi::OsStr</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStrBytes</span>;
<span class="kw">let</span> <span class="ident">string</span> <span class="op">=</span> <span class="string">&quot;foobar&quot;</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">OsStr::new</span>(<span class="ident">string</span>);
<span class="macro">assert_eq!</span>(<span class="ident">string</span>.<span class="ident">as_bytes</span>(), <span class="kw-2">&amp;</span><span class="kw-2">*</span><span class="ident">os_string</span>.<span class="ident">to_raw_bytes</span>());</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-OsStrBytes-for-OsStr" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#426-447">source</a></span><a href="#impl-OsStrBytes-for-OsStr" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.OsStrBytes.html" title="trait os_str_bytes::OsStrBytes">OsStrBytes</a> for <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a></h3></section></summary><div class="impl-items"><section id="method.assert_from_raw_bytes" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#428-433">source</a></span><a href="#method.assert_from_raw_bytes" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_bytes" class="fnname">assert_from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_raw_bytes" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#436-441">source</a></span><a href="#method.from_raw_bytes" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_raw_bytes" class="fnname">from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt;, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_bytes</code> instead, or enable the checked_conversions feature</p>
</div></span></details><section id="method.to_raw_bytes" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#444-446">source</a></span><a href="#method.to_raw_bytes" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_raw_bytes" class="fnname">to_raw_bytes</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'_, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-OsStrBytes-for-Path" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#449-470">source</a></span><a href="#impl-OsStrBytes-for-Path" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.OsStrBytes.html" title="trait os_str_bytes::OsStrBytes">OsStrBytes</a> for <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/path/struct.Path.html" title="struct std::path::Path">Path</a></h3></section></summary><div class="impl-items"><section id="method.assert_from_raw_bytes-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#451-456">source</a></span><a href="#method.assert_from_raw_bytes-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_bytes" class="fnname">assert_from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_raw_bytes-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#459-464">source</a></span><a href="#method.from_raw_bytes-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_raw_bytes" class="fnname">from_raw_bytes</a>&lt;'a, S&gt;(string: S) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, Self&gt;, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;&gt;,&nbsp;</span></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_bytes</code> instead, or enable the checked_conversions feature</p>
</div></span></details><section id="method.to_raw_bytes-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#467-469">source</a></span><a href="#method.to_raw_bytes-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_raw_bytes" class="fnname">to_raw_bytes</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'_, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/os_str_bytes/trait.OsStrBytes.js" data-ignore-extern-crates="std" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

View File

@ -0,0 +1,47 @@
<!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="A platform agnostic variant of `OsStringExt`."><meta name="keywords" content="rust, rustlang, rust-lang, OsStringBytes"><title>OsStringBytes in os_str_bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">OsStringBytes</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.assert_from_raw_vec">assert_from_raw_vec</a></li><li><a href="#tymethod.from_raw_vec">from_raw_vec</a></li><li><a href="#tymethod.into_raw_vec">into_raw_vec</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-OsStringBytes-for-OsString">OsString</a></li><li><a href="#impl-OsStringBytes-for-PathBuf">PathBuf</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In os_str_bytes</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">os_str_bytes</a>::<wbr><a class="trait" href="#">OsStringBytes</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#478-562">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait OsStringBytes: Sealed + <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
fn <a href="#tymethod.assert_from_raw_vec" class="fnname">assert_from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.from_raw_vec" class="fnname">from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.into_raw_vec" class="fnname">into_raw_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;;
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A platform agnostic variant of <a href="https://doc.rust-lang.org/1.64.0/std/os/unix/ffi/os_str/trait.OsStringExt.html"><code>OsStringExt</code></a>.</p>
<p>For more information, see <a href="index.html">the module-level documentation</a>.</p>
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.assert_from_raw_vec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#505">source</a></div><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_vec" class="fnname">assert_from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; Self</h4></div></summary><div class="docblock"><p>Converts a byte string into an equivalent platform-native string.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if the string is not valid for the <a href="index.html#encoding">unspecified encoding</a> used
by this crate.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">std::ffi::OsString</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStringBytes</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">env::current_exe</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">os_bytes</span> <span class="op">=</span> <span class="ident">os_string</span>.<span class="ident">clone</span>().<span class="ident">into_raw_vec</span>();
<span class="macro">assert_eq!</span>(<span class="ident">os_string</span>, <span class="ident">OsString::assert_from_raw_vec</span>(<span class="ident">os_bytes</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.from_raw_vec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#540">source</a></div><h4 class="code-header">fn <a href="#tymethod.from_raw_vec" class="fnname">from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt;</h4></div></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_vec</code> instead, or enable the checked_conversions feature</p>
</div></span><div class="docblock"><p>Converts a byte string into an equivalent platform-native string.</p>
<p><a href="trait.OsStringBytes.html#tymethod.assert_from_raw_vec"><code>assert_from_raw_vec</code></a> should almost always be used instead. For
more information, see <a href="struct.EncodingError.html" title="EncodingError"><code>EncodingError</code></a>.</p>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>See documentation for <a href="struct.EncodingError.html" title="EncodingError"><code>EncodingError</code></a>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">std::ffi::OsString</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStringBytes</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">env::current_exe</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">os_bytes</span> <span class="op">=</span> <span class="ident">os_string</span>.<span class="ident">clone</span>().<span class="ident">into_raw_vec</span>();
<span class="macro">assert_eq!</span>(<span class="ident">os_string</span>, <span class="ident">OsString::from_raw_vec</span>(<span class="ident">os_bytes</span>).<span class="ident">unwrap</span>());</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.into_raw_vec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#561">source</a></div><h4 class="code-header">fn <a href="#tymethod.into_raw_vec" class="fnname">into_raw_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;</h4></div></summary><div class="docblock"><p>Converts a platform-native string into an equivalent byte string.</p>
<p>The returned string will use an <a href="index.html#encoding">unspecified encoding</a>.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::ffi::OsString</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::OsStringBytes</span>;
<span class="kw">let</span> <span class="ident">string</span> <span class="op">=</span> <span class="string">&quot;foobar&quot;</span>.<span class="ident">to_owned</span>();
<span class="kw">let</span> <span class="ident">os_string</span>: <span class="ident">OsString</span> <span class="op">=</span> <span class="ident">string</span>.<span class="ident">clone</span>().<span class="ident">into</span>();
<span class="macro">assert_eq!</span>(<span class="ident">string</span>.<span class="ident">into_bytes</span>(), <span class="ident">os_string</span>.<span class="ident">into_raw_vec</span>());</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-OsStringBytes-for-OsString" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#564-579">source</a></span><a href="#impl-OsStringBytes-for-OsString" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.OsStringBytes.html" title="trait os_str_bytes::OsStringBytes">OsStringBytes</a> for <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a></h3></section></summary><div class="impl-items"><section id="method.assert_from_raw_vec" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#566-568">source</a></span><a href="#method.assert_from_raw_vec" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_vec" class="fnname">assert_from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; Self</h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_raw_vec" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#571-573">source</a></span><a href="#method.from_raw_vec" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_raw_vec" class="fnname">from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt;</h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_vec</code> instead, or enable the checked_conversions feature</p>
</div></span></details><section id="method.into_raw_vec" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#576-578">source</a></span><a href="#method.into_raw_vec" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.into_raw_vec" class="fnname">into_raw_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-OsStringBytes-for-PathBuf" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#581-596">source</a></span><a href="#impl-OsStringBytes-for-PathBuf" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.OsStringBytes.html" title="trait os_str_bytes::OsStringBytes">OsStringBytes</a> for <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></h3></section></summary><div class="impl-items"><section id="method.assert_from_raw_vec-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#583-585">source</a></span><a href="#method.assert_from_raw_vec-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.assert_from_raw_vec" class="fnname">assert_from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; Self</h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_raw_vec-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#588-590">source</a></span><a href="#method.from_raw_vec-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_raw_vec" class="fnname">from_raw_vec</a>(string: <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, <a class="struct" href="struct.EncodingError.html" title="struct os_str_bytes::EncodingError">EncodingError</a>&gt;</h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated: <p>use <code>assert_from_raw_vec</code> instead, or enable the checked_conversions feature</p>
</div></span></details><section id="method.into_raw_vec-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/lib.rs.html#593-595">source</a></span><a href="#method.into_raw_vec-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.into_raw_vec" class="fnname">into_raw_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>&gt;</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/os_str_bytes/trait.OsStringBytes.js" data-ignore-extern-crates="std" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

View File

@ -0,0 +1,4 @@
<!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="Allows a type to be used for searching by `RawOsStr` and `RawOsString`."><meta name="keywords" content="rust, rustlang, rust-lang, Pattern"><title>Pattern in os_str_bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Pattern</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-Pattern-for-%26%27a%20String">&amp;&#39;a String</a></li><li><a href="#impl-Pattern-for-%26str">&amp;str</a></li><li><a href="#impl-Pattern-for-char">char</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In os_str_bytes</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">os_str_bytes</a>::<wbr><a class="trait" href="#">Pattern</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/os_str_bytes/pattern.rs.html#36-42">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait Pattern: Sealed { }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Allows a type to be used for searching by <a href="struct.RawOsStr.html"><code>RawOsStr</code></a> and <a href="struct.RawOsString.html"><code>RawOsString</code></a>.</p>
<p>This trait is very similar to <a href="https://doc.rust-lang.org/1.64.0/core/str/pattern/trait.Pattern.html"><code>str::pattern::Pattern</code></a>, but its methods
are private and it is implemented for different types.</p>
</div></details><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><section id="impl-Pattern-for-char" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/pattern.rs.html#44-55">source</a></span><a href="#impl-Pattern-for-char" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.Pattern.html" title="trait os_str_bytes::Pattern">Pattern</a> for <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a></h3></section><section id="impl-Pattern-for-%26str" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/pattern.rs.html#57-63">source</a></span><a href="#impl-Pattern-for-%26str" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.Pattern.html" title="trait os_str_bytes::Pattern">Pattern</a> for &amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a></h3></section><section id="impl-Pattern-for-%26%27a%20String" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/pattern.rs.html#65-71">source</a></span><a href="#impl-Pattern-for-%26%27a%20String" class="anchor"></a><h3 class="code-header in-band">impl&lt;'a&gt; <a class="trait" href="trait.Pattern.html" title="trait os_str_bytes::Pattern">Pattern</a> for &amp;'a <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/os_str_bytes/pattern/trait.Pattern.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>

View File

@ -0,0 +1,26 @@
<!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="Extensions to `Cow&lt;RawOsStr&gt;` for additional conversions."><meta name="keywords" content="rust, rustlang, rust-lang, RawOsStrCow"><title>RawOsStrCow in os_str_bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../os_str_bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">RawOsStrCow</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.into_os_str">into_os_str</a></li><li><a href="#tymethod.into_raw_bytes">into_raw_bytes</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-RawOsStrCow%3C%27a%3E-for-Cow%3C%27a%2C%20RawOsStr%3E">Cow&lt;&#39;a, RawOsStr&gt;</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In os_str_bytes</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../os_str_bytes/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">os_str_bytes</a>::<wbr><a class="trait" href="#">RawOsStrCow</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#918-959">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait RawOsStrCow&lt;'a&gt;: Sealed {
fn <a href="#tymethod.into_os_str" class="fnname">into_os_str</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.into_raw_bytes" class="fnname">into_raw_bytes</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;;
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extensions to <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html"><code>Cow&lt;RawOsStr&gt;</code></a> for additional conversions.</p>
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.into_os_str" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#937">source</a></div><h4 class="code-header">fn <a href="#tymethod.into_os_str" class="fnname">into_os_str</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;</h4></div></summary><div class="docblock"><p>Converts this representation back to a platform-native string.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::env</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::RawOsStr</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::RawOsStrCow</span>;
<span class="kw">let</span> <span class="ident">os_string</span> <span class="op">=</span> <span class="ident">env::current_exe</span>()<span class="question-mark">?</span>.<span class="ident">into_os_string</span>();
<span class="kw">let</span> <span class="ident">raw</span> <span class="op">=</span> <span class="ident">RawOsStr::new</span>(<span class="kw-2">&amp;</span><span class="ident">os_string</span>);
<span class="macro">assert_eq!</span>(<span class="ident">os_string</span>, <span class="ident">raw</span>.<span class="ident">into_os_str</span>());</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.into_raw_bytes" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#958">source</a></div><h4 class="code-header">fn <a href="#tymethod.into_raw_bytes" class="fnname">into_raw_bytes</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;</h4></div></summary><div class="docblock"><p>Returns the byte string stored by this container.</p>
<p>The returned string will use an <a href="index.html#encoding">unspecified encoding</a>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::borrow::Cow</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::RawOsStr</span>;
<span class="kw">use</span> <span class="ident">os_str_bytes::RawOsStrCow</span>;
<span class="kw">let</span> <span class="ident">string</span> <span class="op">=</span> <span class="string">&quot;foobar&quot;</span>;
<span class="kw">let</span> <span class="ident">raw</span> <span class="op">=</span> <span class="ident">Cow::Borrowed</span>(<span class="ident">RawOsStr::from_str</span>(<span class="ident">string</span>));
<span class="macro">assert_eq!</span>(<span class="ident">string</span>.<span class="ident">as_bytes</span>(), <span class="kw-2">&amp;</span><span class="kw-2">*</span><span class="ident">raw</span>.<span class="ident">into_raw_bytes</span>());</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-RawOsStrCow%3C%27a%3E-for-Cow%3C%27a%2C%20RawOsStr%3E" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#961-977">source</a></span><a href="#impl-RawOsStrCow%3C%27a%3E-for-Cow%3C%27a%2C%20RawOsStr%3E" class="anchor"></a><h3 class="code-header in-band">impl&lt;'a&gt; <a class="trait" href="trait.RawOsStrCow.html" title="trait os_str_bytes::RawOsStrCow">RawOsStrCow</a>&lt;'a&gt; for <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="struct.RawOsStr.html" title="struct os_str_bytes::RawOsStr">RawOsStr</a>&gt;</h3></section></summary><div class="impl-items"><section id="method.into_os_str" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#963-968">source</a></span><a href="#method.into_os_str" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.into_os_str" class="fnname">into_os_str</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="https://doc.rust-lang.org/1.64.0/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;</h4></section><section id="method.into_raw_bytes" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/os_str_bytes/raw_str.rs.html#971-976">source</a></span><a href="#method.into_raw_bytes" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.into_raw_bytes" class="fnname">into_raw_bytes</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, [<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.u8.html">u8</a>]&gt;</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/os_str_bytes/raw_str/trait.RawOsStrCow.js" data-ignore-extern-crates="alloc" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="os_str_bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>