Adding large folders

This commit is contained in:
2026-02-26 12:00:21 -05:00
parent 5400d82acd
commit 49701c85ad
47332 changed files with 1942573 additions and 0 deletions

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="Helper types for trait impls."><title>writeable::adapters - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">Module adapters</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module adapters</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate writeable</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">writeable</a></div><h1>Module <span>adapters</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/writeable/lib.rs.html#107">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper types for trait impls.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.CoreWriteAsPartsWrite.html" title="struct writeable::adapters::CoreWriteAsPartsWrite">Core<wbr>Write<wbr>AsParts<wbr>Write</a></dt><dd>A wrapper around a type implementing <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write"><code>fmt::Write</code></a> that implements <a href="../trait.PartsWrite.html" title="trait writeable::PartsWrite"><code>PartsWrite</code></a>.</dd><dt><a class="struct" href="struct.LossyWrap.html" title="struct writeable::adapters::LossyWrap">Lossy<wbr>Wrap</a></dt><dt><a class="struct" href="struct.TryWriteableInfallibleAsWriteable.html" title="struct writeable::adapters::TryWriteableInfallibleAsWriteable">TryWriteable<wbr>Infallible<wbr>AsWriteable</a></dt><dd>A wrapper around <a href="../trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a> that implements <a href="../trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>
if <a href="../trait.TryWriteable.html#associatedtype.Error" title="associated type writeable::TryWriteable::Error"><code>TryWriteable::Error</code></a> is <a href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible"><code>Infallible</code></a>.</dd><dt><a class="struct" href="struct.WithPart.html" title="struct writeable::adapters::WithPart">With<wbr>Part</a></dt><dd>A <a href="../trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> that writes out the given part.</dd><dt><a class="struct" href="struct.WriteableAsTryWriteableInfallible.html" title="struct writeable::adapters::WriteableAsTryWriteableInfallible">Writeable<wbr>AsTry<wbr>Writeable<wbr>Infallible</a></dt><dd>A wrapper around <a href="../trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> that implements <a href="../trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a>
with <a href="../trait.TryWriteable.html#associatedtype.Error" title="associated type writeable::TryWriteable::Error"><code>TryWriteable::Error</code></a> set to <a href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible"><code>Infallible</code></a>.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["CoreWriteAsPartsWrite","LossyWrap","TryWriteableInfallibleAsWriteable","WithPart","WriteableAsTryWriteableInfallible"]};

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

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 @@
<!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"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">All</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#macros">Crate Items</a></h3><ul class="block"><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>List of all items</h1><rustdoc-toolbar></rustdoc-toolbar></div><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.LengthHint.html">LengthHint</a></li><li><a href="struct.Part.html">Part</a></li><li><a href="adapters/struct.CoreWriteAsPartsWrite.html">adapters::CoreWriteAsPartsWrite</a></li><li><a href="adapters/struct.LossyWrap.html">adapters::LossyWrap</a></li><li><a href="adapters/struct.TryWriteableInfallibleAsWriteable.html">adapters::TryWriteableInfallibleAsWriteable</a></li><li><a href="adapters/struct.WithPart.html">adapters::WithPart</a></li><li><a href="adapters/struct.WriteableAsTryWriteableInfallible.html">adapters::WriteableAsTryWriteableInfallible</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.PartsWrite.html">PartsWrite</a></li><li><a href="trait.TryWriteable.html">TryWriteable</a></li><li><a href="trait.Writeable.html">Writeable</a></li></ul><h3 id="macros">Macros</h3><ul class="all-items"><li><a href="macro.assert_try_writeable_eq.html">assert_try_writeable_eq</a></li><li><a href="macro.assert_try_writeable_parts_eq.html">assert_try_writeable_parts_eq</a></li><li><a href="macro.impl_display_with_writeable.html">impl_display_with_writeable</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.cmp_str.html">cmp_str</a></li><li><a href="fn.cmp_utf8.html">cmp_utf8</a></li></ul></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../writeable/fn.cmp_str.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/fn.cmp_str.html">../../writeable/fn.cmp_str.html</a>...</p>
<script>location.replace("../../writeable/fn.cmp_str.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=../../writeable/fn.cmp_utf8.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/fn.cmp_utf8.html">../../writeable/fn.cmp_utf8.html</a>...</p>
<script>location.replace("../../writeable/fn.cmp_utf8.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<!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="Compares the contents of a `Writeable` to the given bytes without allocating a String to hold the `Writeable` contents."><title>cmp_str in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">cmp_str</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">cmp_str</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate writeable</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Function <span class="fn">cmp_str</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/cmp.rs.html#101-103">Source</a> </span></div><pre class="rust item-decl"><code>pub fn cmp_str(writeable: &amp;impl <a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a>, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Compares the contents of a <code>Writeable</code> to the given bytes
without allocating a String to hold the <code>Writeable</code> contents.</p>
<p>This returns a lexicographical comparison, the same as if the Writeable
were first converted to a String and then compared with <code>Ord</code>. For a
string ordering suitable for display to end users, use a localized
collation crate, such as <code>icu_collator</code>.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>core::cmp::Ordering;
<span class="kw">use </span>core::fmt;
<span class="kw">use </span>writeable::Writeable;
<span class="kw">struct </span>WelcomeMessage&lt;<span class="lifetime">'s</span>&gt; {
<span class="kw">pub </span>name: <span class="kw-2">&amp;</span><span class="lifetime">'s </span>str,
}
<span class="kw">impl</span>&lt;<span class="lifetime">'s</span>&gt; Writeable <span class="kw">for </span>WelcomeMessage&lt;<span class="lifetime">'s</span>&gt; {
<span class="comment">// see impl in Writeable docs
</span>}
<span class="kw">let </span>message = WelcomeMessage { name: <span class="string">"Alice" </span>};
<span class="kw">let </span>message_str = message.write_to_string();
<span class="macro">assert_eq!</span>(Ordering::Equal, writeable::cmp_str(<span class="kw-2">&amp;</span>message, <span class="string">"Hello, Alice!"</span>));
<span class="macro">assert_eq!</span>(Ordering::Greater, writeable::cmp_str(<span class="kw-2">&amp;</span>message, <span class="string">"Alice!"</span>));
<span class="macro">assert_eq!</span>(Ordering::Greater, (<span class="kw-2">*</span>message_str).cmp(<span class="string">"Alice!"</span>));
<span class="macro">assert_eq!</span>(Ordering::Less, writeable::cmp_str(<span class="kw-2">&amp;</span>message, <span class="string">"Hello, Bob!"</span>));
<span class="macro">assert_eq!</span>(Ordering::Less, (<span class="kw-2">*</span>message_str).cmp(<span class="string">"Hello, Bob!"</span>));</code></pre></div></div></details></section></div></main></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="Compares the contents of a `Writeable` to the given UTF-8 bytes without allocating memory."><title>cmp_utf8 in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">cmp_utf8</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Function <span class="fn">cmp_<wbr>utf8</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/cmp.rs.html#54-58">Source</a> </span></div><pre class="rust item-decl"><code>pub fn cmp_utf8(writeable: &amp;impl <a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a>, other: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Compares the contents of a <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> to the given UTF-8 bytes without allocating memory.</p>
<p>For more details, see: <a href="fn.cmp_str.html" title="fn writeable::cmp_str"><code>cmp_str</code></a></p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,49 @@
<!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 defines `Writeable`, a trait representing an object that can be written to a sink implementing `std::fmt::Write`. It is an alternative to `std::fmt::Display` with the addition of a function indicating the number of bytes to be written."><title>writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">Crate writeable</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#benchmarks" title="Benchmarks">Benchmarks</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>writeable</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/lib.rs.html#6-509">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This crate defines <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>, a trait representing an object that can be written to a
sink implementing <code>std::fmt::Write</code>. It is an alternative to <code>std::fmt::Display</code> with the
addition of a function indicating the number of bytes to be written.</p>
<p><code>Writeable</code> improves upon <code>std::fmt::Display</code> in two ways:</p>
<ol>
<li>More efficient, since the sink can pre-allocate bytes.</li>
<li>Smaller code, since the format machinery can be short-circuited.</li>
</ol>
<p>This crate also exports <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a>, a writeable that supports a custom error.</p>
<h2 id="benchmarks"><a class="doc-anchor" href="#benchmarks">§</a>Benchmarks</h2>
<p>The benchmarks to generate the following data can be found in the <code>benches</code> directory.</p>
<div><table><thead><tr><th>Case</th><th><code>Writeable</code></th><th><code>Display</code></th></tr></thead><tbody>
<tr><td>Create string from single-string message (139 chars)</td><td>15.642 ns</td><td>19.251 ns</td></tr>
<tr><td>Create string from complex message</td><td>35.830 ns</td><td>89.478 ns</td></tr>
<tr><td>Write complex message to buffer</td><td>57.336 ns</td><td>64.408 ns</td></tr>
</tbody></table>
</div><h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::fmt;
<span class="kw">use </span>writeable::assert_writeable_eq;
<span class="kw">use </span>writeable::LengthHint;
<span class="kw">use </span>writeable::Writeable;
<span class="kw">struct </span>WelcomeMessage&lt;<span class="lifetime">'s</span>&gt; {
<span class="kw">pub </span>name: <span class="kw-2">&amp;</span><span class="lifetime">'s </span>str,
}
<span class="kw">impl</span>&lt;<span class="lifetime">'s</span>&gt; Writeable <span class="kw">for </span>WelcomeMessage&lt;<span class="lifetime">'s</span>&gt; {
<span class="kw">fn </span>write_to&lt;W: fmt::Write + <span class="question-mark">?</span>Sized&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, sink: <span class="kw-2">&amp;mut </span>W) -&gt; fmt::Result {
sink.write_str(<span class="string">"Hello, "</span>)<span class="question-mark">?</span>;
sink.write_str(<span class="self">self</span>.name)<span class="question-mark">?</span>;
sink.write_char(<span class="string">'!'</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}
<span class="kw">fn </span>writeable_length_hint(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; LengthHint {
<span class="comment">// "Hello, " + '!' + length of name
</span>LengthHint::exact(<span class="number">8 </span>+ <span class="self">self</span>.name.len())
}
}
<span class="kw">let </span>message = WelcomeMessage { name: <span class="string">"Alice" </span>};
<span class="macro">assert_writeable_eq!</span>(<span class="kw-2">&amp;</span>message, <span class="string">"Hello, Alice!"</span>);
<span class="comment">// Types implementing `Writeable` are recommended to also implement `fmt::Display`.
// This can be simply done by redirecting to the `Writeable` implementation:
</span><span class="macro">writeable::impl_display_with_writeable!</span>(WelcomeMessage&lt;<span class="lifetime">'_</span>&gt;);
<span class="macro">assert_eq!</span>(message.to_string(), <span class="string">"Hello, Alice!"</span>);</code></pre></div></div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="adapters/index.html" title="mod writeable::adapters">adapters</a></dt><dd>Helper types for trait impls.</dd></dl><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><dl class="item-table"><dt><a class="macro" href="macro.assert_try_writeable_eq.html" title="macro writeable::assert_try_writeable_eq">assert_<wbr>try_<wbr>writeable_<wbr>eq</a></dt><dd>Testing macros for types implementing <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a>.</dd><dt><a class="macro" href="macro.assert_try_writeable_parts_eq.html" title="macro writeable::assert_try_writeable_parts_eq">assert_<wbr>try_<wbr>writeable_<wbr>parts_<wbr>eq</a></dt><dd>See <a href="macro.assert_try_writeable_eq.html" title="macro writeable::assert_try_writeable_eq"><code>assert_try_writeable_eq</code></a>.</dd><dt><a class="macro" href="macro.impl_display_with_writeable.html" title="macro writeable::impl_display_with_writeable">impl_<wbr>display_<wbr>with_<wbr>writeable</a></dt><dd>Implements <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display"><code>Display</code></a> for types that implement <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.LengthHint.html" title="struct writeable::LengthHint">Length<wbr>Hint</a></dt><dd>A hint to help consumers of <code>Writeable</code> pre-allocate bytes before they call
<a href="trait.Writeable.html#method.write_to" title="method writeable::Writeable::write_to"><code>write_to</code></a>.</dd><dt><a class="struct" href="struct.Part.html" title="struct writeable::Part">Part</a></dt><dd><a href="struct.Part.html" title="struct writeable::Part"><code>Part</code></a>s are used as annotations for formatted strings.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">Parts<wbr>Write</a></dt><dd>A sink that supports annotating parts of the string with <a href="struct.Part.html" title="struct writeable::Part"><code>Part</code></a>s.</dd><dt><a class="trait" href="trait.TryWriteable.html" title="trait writeable::TryWriteable">TryWriteable</a></dt><dd>A writeable object that can fail while writing.</dd><dt><a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a></dt><dd><code>Writeable</code> is an alternative to <code>std::fmt::Display</code> with the addition of a length function.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.cmp_str.html" title="fn writeable::cmp_str">cmp_str</a></dt><dd>Compares the contents of a <code>Writeable</code> to the given bytes
without allocating a String to hold the <code>Writeable</code> contents.</dd><dt><a class="fn" href="fn.cmp_utf8.html" title="fn writeable::cmp_utf8">cmp_<wbr>utf8</a></dt><dd>Compares the contents of a <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> to the given UTF-8 bytes without allocating memory.</dd></dl></section></div></main></body></html>

View File

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

View File

@@ -0,0 +1,22 @@
<!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="Testing macros for types implementing `TryWriteable`."><title>assert_try_writeable_eq in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc macro"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">assert_try_writeable_eq</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Macro <span class="macro">assert_<wbr>try_<wbr>writeable_<wbr>eq</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/try_writeable.rs.html#377-419">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! assert_try_writeable_eq {
($actual_writeable:expr, $expected_str:expr $(,)?) =&gt; { ... };
($actual_writeable:expr, $expected_str:expr, $expected_result:expr $(,)?) =&gt; { ... };
($actual_writeable:expr, $expected_str:expr, $expected_result:expr, $($arg:tt)+) =&gt; { ... };
(@internal, $actual_writeable:expr, $expected_str:expr, $expected_result:expr, $($arg:tt)+) =&gt; { ... };
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Testing macros for types implementing <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a>.</p>
<p>Arguments, in order:</p>
<ol>
<li>The <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a> under test</li>
<li>The expected string value</li>
<li>The expected result value, or <code>Ok(())</code> if omitted</li>
<li><a href="macro.assert_try_writeable_parts_eq.html" title="macro writeable::assert_try_writeable_parts_eq"><code>*_parts_eq</code></a> only: a list of parts (<code>[(start, end, Part)]</code>)</li>
</ol>
<p>Any remaining arguments get passed to <code>format!</code></p>
<p>The macros tests the following:</p>
<ul>
<li>Equality of string content</li>
<li>Equality of parts (<a href="macro.assert_try_writeable_parts_eq.html" title="macro writeable::assert_try_writeable_parts_eq"><code>*_parts_eq</code></a> only)</li>
<li>Validity of size hint</li>
</ul>
<p>For a usage example, see <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a>.</p>
</div></details></section></div></main></body></html>

View File

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

View File

@@ -0,0 +1,6 @@
<!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="See `assert_try_writeable_eq`."><title>assert_try_writeable_parts_eq in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc macro"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">assert_try_writeable_parts_eq</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Macro <span class="macro">assert_<wbr>try_<wbr>writeable_<wbr>parts_<wbr>eq</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/try_writeable.rs.html#423-434">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! assert_try_writeable_parts_eq {
($actual_writeable:expr, $expected_str:expr, $expected_parts:expr $(,)?) =&gt; { ... };
($actual_writeable:expr, $expected_str:expr, $expected_result:expr, $expected_parts:expr $(,)?) =&gt; { ... };
($actual_writeable:expr, $expected_str:expr, $expected_result:expr, $expected_parts:expr, $($arg:tt)+) =&gt; { ... };
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>See <a href="macro.assert_try_writeable_eq.html" title="macro writeable::assert_try_writeable_eq"><code>assert_try_writeable_eq</code></a>.</p>
</div></details></section></div></main></body></html>

View File

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

View File

@@ -0,0 +1,11 @@
<!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="Implements `Display` for types that implement `Writeable`."><title>impl_display_with_writeable in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc macro"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">impl_display_with_writeable</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Macro <span class="macro">impl_<wbr>display_<wbr>with_<wbr>writeable</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/lib.rs.html#372-397">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! impl_display_with_writeable {
(@display, $type:ty) =&gt; { ... };
($type:ty $(, #[$alloc_feature:meta])? ) =&gt; { ... };
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implements <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display"><code>Display</code></a> for types that implement <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>.</p>
<p>Its recommended to do this for every <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> type, as it will add
support for <code>core::fmt</code> features like <a href="https://doc.rust-lang.org/1.93.1/alloc/fmt/index.html" title="mod alloc::fmt"><code>fmt!</code></a>,
<a href="https://doc.rust-lang.org/1.93.1/std/macro.print.html" title="macro std::print"><code>print!</code></a>, <a href="https://doc.rust-lang.org/1.93.1/core/macro.write.html" title="macro core::write"><code>write!</code></a>, etc.</p>
<p>This macro also adds a concrete <code>to_string</code> function. This function will shadow the
standard library <code>ToString</code>, using the more efficient writeable-based code path.
To add only <code>Display</code>, use the <code>@display</code> macro variant.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../writeable/adapters/struct.CoreWriteAsPartsWrite.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/adapters/struct.CoreWriteAsPartsWrite.html">../../writeable/adapters/struct.CoreWriteAsPartsWrite.html</a>...</p>
<script>location.replace("../../writeable/adapters/struct.CoreWriteAsPartsWrite.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=../../writeable/adapters/struct.WithPart.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/adapters/struct.WithPart.html">../../writeable/adapters/struct.WithPart.html</a>...</p>
<script>location.replace("../../writeable/adapters/struct.WithPart.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["cmp_str","cmp_utf8"],"macro":["assert_try_writeable_eq","assert_try_writeable_parts_eq","impl_display_with_writeable"],"mod":["adapters"],"struct":["LengthHint","Part"],"trait":["PartsWrite","TryWriteable","Writeable"]};

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,16 @@
<!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 sink that supports annotating parts of the string with `Part`s."><title>PartsWrite in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">PartsWrite</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Parts<wbr>Write</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.SubPartsWrite" title="SubPartsWrite">SubPartsWrite</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.with_part" title="with_part">with_part</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate writeable</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Trait <span class="trait">Parts<wbr>Write</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/lib.rs.html#252-261">Source</a> </span></div><pre class="rust item-decl"><code>pub trait PartsWrite: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> {
type <a href="#associatedtype.SubPartsWrite" class="associatedtype">SubPartsWrite</a>: <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>;
// Required method
fn <a href="#tymethod.with_part" class="fn">with_part</a>(
&amp;mut self,
part: <a class="struct" href="struct.Part.html" title="struct writeable::Part">Part</a>,
f: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut Self::<a class="associatedtype" href="trait.PartsWrite.html#associatedtype.SubPartsWrite" title="type writeable::PartsWrite::SubPartsWrite">SubPartsWrite</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>,
) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A sink that supports annotating parts of the string with <a href="struct.Part.html" title="struct writeable::Part"><code>Part</code></a>s.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><section id="associatedtype.SubPartsWrite" class="method"><a class="src rightside" href="../src/writeable/lib.rs.html#253">Source</a><h4 class="code-header">type <a href="#associatedtype.SubPartsWrite" class="associatedtype">SubPartsWrite</a>: <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></h4></section></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.with_part" class="method"><a class="src rightside" href="../src/writeable/lib.rs.html#256-260">Source</a><h4 class="code-header">fn <a href="#tymethod.with_part" class="fn">with_part</a>(
&amp;mut self,
part: <a class="struct" href="struct.Part.html" title="struct writeable::Part">Part</a>,
f: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut Self::<a class="associatedtype" href="trait.PartsWrite.html#associatedtype.SubPartsWrite" title="type writeable::PartsWrite::SubPartsWrite">SubPartsWrite</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>,
) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class="docblock"><p>Annotates all strings written by the closure with the given <a href="struct.Part.html" title="struct writeable::Part"><code>Part</code></a>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-PartsWrite-for-CoreWriteAsPartsWrite%3CW%3E" class="impl"><a class="src rightside" href="../src/writeable/parts_write_adapter.rs.html#24-35">Source</a><a href="#impl-PartsWrite-for-CoreWriteAsPartsWrite%3CW%3E" class="anchor">§</a><h3 class="code-header">impl&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> for <a class="struct" href="adapters/struct.CoreWriteAsPartsWrite.html" title="struct writeable::adapters::CoreWriteAsPartsWrite">CoreWriteAsPartsWrite</a>&lt;W&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.SubPartsWrite-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/writeable/parts_write_adapter.rs.html#25">Source</a><a href="#associatedtype.SubPartsWrite-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SubPartsWrite" class="associatedtype">SubPartsWrite</a> = <a class="struct" href="adapters/struct.CoreWriteAsPartsWrite.html" title="struct writeable::adapters::CoreWriteAsPartsWrite">CoreWriteAsPartsWrite</a>&lt;W&gt;</h4></section></div></details></div><script src="../trait.impl/writeable/trait.PartsWrite.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,146 @@
<!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 writeable object that can fail while writing."><title>TryWriteable in writeable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="writeable" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">TryWriteable</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../writeable/index.html">writeable</a><span class="version">0.6.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">TryWriteable</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#implementer-notes" title="Implementer Notes">Implementer Notes</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.try_write_to_parts" title="try_write_to_parts">try_write_to_parts</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.try_write_to" title="try_write_to">try_write_to</a></li><li><a href="#method.writeable_length_hint" title="writeable_length_hint">writeable_length_hint</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-TryWriteable-for-Result%3CT,+E%3E" title="Result&#60;T, E&#62;">Result&#60;T, E&#62;</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate writeable</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">writeable</a></div><h1>Trait <span class="trait">TryWriteable</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/writeable/try_writeable.rs.html#95-210">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryWriteable {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>;
// Required method
fn <a href="#tymethod.try_write_to_parts" class="fn">try_write_to_parts</a>&lt;S: <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut S</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;;
// Provided methods
fn <a href="#method.try_write_to" class="fn">try_write_to</a>&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut W</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.writeable_length_hint" class="fn">writeable_length_hint</a>(&amp;self) -&gt; <a class="struct" href="struct.LengthHint.html" title="struct writeable::LengthHint">LengthHint</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A writeable object that can fail while writing.</p>
<p>The default <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a> trait returns a <a href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error"><code>fmt::Error</code></a>, which originates from the sink.
In contrast, this trait allows the <em>writeable itself</em> to trigger an error as well.</p>
<p>Implementations are expected to always make a <em>best attempt</em> at writing to the sink
and should write replacement values in the error state. Therefore, the returned <code>Result</code>
can be safely ignored to emulate a “lossy” mode.</p>
<p>Any error substrings should be annotated with <a href="struct.Part.html#associatedconstant.ERROR" title="associated constant writeable::Part::ERROR"><code>Part::ERROR</code></a>.</p>
<h2 id="implementer-notes"><a class="doc-anchor" href="#implementer-notes">§</a>Implementer Notes</h2>
<p>This trait requires that implementers make a <em>best attempt</em> at writing to the sink,
<em>even in the error state</em>, such as with a placeholder or fallback string.</p>
<p>In <a href="trait.TryWriteable.html#tymethod.try_write_to_parts" title="method writeable::TryWriteable::try_write_to_parts"><code>TryWriteable::try_write_to_parts()</code></a>, error substrings should be annotated with
<a href="struct.Part.html#associatedconstant.ERROR" title="associated constant writeable::Part::ERROR"><code>Part::ERROR</code></a>. Because of this, writing to parts is not default-implemented like
it is on <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>.</p>
<p>The trait is implemented on <a href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result"><code>Result&lt;T, E&gt;</code></a> where <code>T</code> and <code>E</code> both implement <a href="trait.Writeable.html" title="trait writeable::Writeable"><code>Writeable</code></a>;
In the <code>Ok</code> case, <code>T</code> is written, and in the <code>Err</code> case, <code>E</code> is written as a fallback value.
This impl, which writes <a href="struct.Part.html#associatedconstant.ERROR" title="associated constant writeable::Part::ERROR"><code>Part::ERROR</code></a>, can be used as a basis for more advanced impls.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<p>Implementing on a custom type:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>core::fmt;
<span class="kw">use </span>writeable::LengthHint;
<span class="kw">use </span>writeable::PartsWrite;
<span class="kw">use </span>writeable::TryWriteable;
<span class="attr">#[derive(Debug, PartialEq, Eq)]
</span><span class="kw">enum </span>HelloWorldWriteableError {
MissingName,
}
<span class="attr">#[derive(Debug, PartialEq, Eq)]
</span><span class="kw">struct </span>HelloWorldWriteable {
<span class="kw">pub </span>name: <span class="prelude-ty">Option</span>&lt;<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str&gt;,
}
<span class="kw">impl </span>TryWriteable <span class="kw">for </span>HelloWorldWriteable {
<span class="kw">type </span>Error = HelloWorldWriteableError;
<span class="kw">fn </span>try_write_to_parts&lt;S: PartsWrite + <span class="question-mark">?</span>Sized&gt;(
<span class="kw-2">&amp;</span><span class="self">self</span>,
sink: <span class="kw-2">&amp;mut </span>S,
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="prelude-ty">Result</span>&lt;(), <span class="self">Self</span>::Error&gt;, fmt::Error&gt; {
sink.write_str(<span class="string">"Hello, "</span>)<span class="question-mark">?</span>;
<span class="comment">// Use `impl TryWriteable for Result` to generate the error part:
</span><span class="kw">let </span>err = <span class="self">self</span>.name.ok_or(<span class="string">"nobody"</span>).try_write_to_parts(sink)<span class="question-mark">?</span>.err();
sink.write_char(<span class="string">'!'</span>)<span class="question-mark">?</span>;
<span class="comment">// Return a doubly-wrapped Result.
// The outer Result is for fmt::Error, handled by the `?`s above.
// The inner Result is for our own Self::Error.
</span><span class="kw">if </span>err.is_none() {
<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(()))
} <span class="kw">else </span>{
<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(HelloWorldWriteableError::MissingName))
}
}
<span class="kw">fn </span>writeable_length_hint(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; LengthHint {
<span class="self">self</span>.name.ok_or(<span class="string">"nobody"</span>).writeable_length_hint() + <span class="number">8
</span>}
}
<span class="comment">// Success case:
</span><span class="macro">writeable::assert_try_writeable_eq!</span>(
HelloWorldWriteable {
name: <span class="prelude-val">Some</span>(<span class="string">"Alice"</span>)
},
<span class="string">"Hello, Alice!"
</span>);
<span class="comment">// Failure case, including the ERROR part:
</span><span class="macro">writeable::assert_try_writeable_parts_eq!</span>(
HelloWorldWriteable { name: <span class="prelude-val">None </span>},
<span class="string">"Hello, nobody!"</span>,
<span class="prelude-val">Err</span>(HelloWorldWriteableError::MissingName),
[(<span class="number">7</span>, <span class="number">13</span>, writeable::Part::ERROR)]
);</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><section id="associatedtype.Error" class="method"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#96">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a></h4></section></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.try_write_to_parts" class="method"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#164-167">Source</a><h4 class="code-header">fn <a href="#tymethod.try_write_to_parts" class="fn">try_write_to_parts</a>&lt;S: <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut S</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Writes the content of this writeable to a sink with parts (annotations).</p>
<p>For more information, see:</p>
<ul>
<li><a href="trait.TryWriteable.html#method.try_write_to" title="method writeable::TryWriteable::try_write_to"><code>TryWriteable::try_write_to()</code></a> for the general behavior.</li>
<li><a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a> for an example with parts.</li>
<li><a href="struct.Part.html" title="struct writeable::Part"><code>Part</code></a> for more about parts.</li>
</ul>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.try_write_to" class="method"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#150-155">Source</a><h4 class="code-header">fn <a href="#method.try_write_to" class="fn">try_write_to</a>&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut W</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Writes the content of this writeable to a sink.</p>
<p>If the sink hits an error, writing immediately ends,
<code>Err(</code><a href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error"><code>fmt::Error</code></a><code>)</code> is returned, and the sink does not contain valid output.</p>
<p>If the writeable hits an error, writing is continued with a replacement value,
<code>Ok(Err(</code><a href="trait.TryWriteable.html#associatedtype.Error" title="associated type writeable::TryWriteable::Error"><code>TryWriteable::Error</code></a><code>))</code> is returned, and the caller may continue using the sink.</p>
<h5 id="lossy-mode"><a class="doc-anchor" href="#lossy-mode">§</a>Lossy Mode</h5>
<p>The <a href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error"><code>fmt::Error</code></a> should always be handled, but the <a href="trait.TryWriteable.html#associatedtype.Error" title="associated type writeable::TryWriteable::Error"><code>TryWriteable::Error</code></a> can be
ignored if a fallback string is desired instead of an error.</p>
<p>To handle the sink error, but not the writeable error, write:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let _ </span>= my_writeable.try_write_to(<span class="kw-2">&amp;mut </span>sink)<span class="question-mark">?</span>;</code></pre></div><h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<p>The following examples use <code>Result&lt;&amp;str, usize&gt;</code>, which implements <a href="trait.TryWriteable.html" title="trait writeable::TryWriteable"><code>TryWriteable</code></a> because both <code>&amp;str</code> and <code>usize</code> do.</p>
<p>Success case:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>writeable::TryWriteable;
<span class="kw">let </span>w: <span class="prelude-ty">Result</span>&lt;<span class="kw-2">&amp;</span>str, usize&gt; = <span class="prelude-val">Ok</span>(<span class="string">"success"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>sink = String::new();
<span class="kw">let </span>result = w.try_write_to(<span class="kw-2">&amp;mut </span>sink);
<span class="macro">assert_eq!</span>(result, <span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(())));
<span class="macro">assert_eq!</span>(sink, <span class="string">"success"</span>);</code></pre></div>
<p>Failure case:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>writeable::TryWriteable;
<span class="kw">let </span>w: <span class="prelude-ty">Result</span>&lt;<span class="kw-2">&amp;</span>str, usize&gt; = <span class="prelude-val">Err</span>(<span class="number">44</span>);
<span class="kw">let </span><span class="kw-2">mut </span>sink = String::new();
<span class="kw">let </span>result = w.try_write_to(<span class="kw-2">&amp;mut </span>sink);
<span class="macro">assert_eq!</span>(result, <span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(<span class="number">44</span>)));
<span class="macro">assert_eq!</span>(sink, <span class="string">"44"</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.writeable_length_hint" class="method"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#173-175">Source</a><h4 class="code-header">fn <a href="#method.writeable_length_hint" class="fn">writeable_length_hint</a>(&amp;self) -&gt; <a class="struct" href="struct.LengthHint.html" title="struct writeable::LengthHint">LengthHint</a></h4></section></summary><div class="docblock"><p>Returns a hint for the number of UTF-8 bytes that will be written to the sink.</p>
<p>This function returns the length of the “lossy mode” string; for more information,
see <a href="trait.TryWriteable.html#method.try_write_to" title="method writeable::TryWriteable::try_write_to"><code>TryWriteable::try_write_to()</code></a>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-TryWriteable-for-Result%3CT,+E%3E" class="impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#212-259">Source</a><a href="#impl-TryWriteable-for-Result%3CT,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, E&gt; <a class="trait" href="trait.TryWriteable.html" title="trait writeable::TryWriteable">TryWriteable</a> for <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;<div class="where">where
T: <a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a>,
E: <a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#217">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="method.try_write_to-1" class="method trait-impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#220-228">Source</a><a href="#method.try_write_to-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.try_write_to" class="fn">try_write_to</a>&lt;W: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut W</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.try_write_to_parts" class="method trait-impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#231-241">Source</a><a href="#method.try_write_to_parts" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.try_write_to_parts" class="fn">try_write_to_parts</a>&lt;S: <a class="trait" href="trait.PartsWrite.html" title="trait writeable::PartsWrite">PartsWrite</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
sink: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut S</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryWriteable.html#associatedtype.Error" title="type writeable::TryWriteable::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.writeable_length_hint-1" class="method trait-impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#244-249">Source</a><a href="#method.writeable_length_hint-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.writeable_length_hint" class="fn">writeable_length_hint</a>(&amp;self) -&gt; <a class="struct" href="struct.LengthHint.html" title="struct writeable::LengthHint">LengthHint</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-TryWriteable-for-WriteableAsTryWriteableInfallible%3CT%3E" class="impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#322-354">Source</a><a href="#impl-TryWriteable-for-WriteableAsTryWriteableInfallible%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.TryWriteable.html" title="trait writeable::TryWriteable">TryWriteable</a> for <a class="struct" href="adapters/struct.WriteableAsTryWriteableInfallible.html" title="struct writeable::adapters::WriteableAsTryWriteableInfallible">WriteableAsTryWriteableInfallible</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="trait.Writeable.html" title="trait writeable::Writeable">Writeable</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/writeable/try_writeable.rs.html#326">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></div></details></div><script src="../trait.impl/writeable/try_writeable/trait.TryWriteable.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>

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=../../writeable/adapters/struct.TryWriteableInfallibleAsWriteable.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/adapters/struct.TryWriteableInfallibleAsWriteable.html">../../writeable/adapters/struct.TryWriteableInfallibleAsWriteable.html</a>...</p>
<script>location.replace("../../writeable/adapters/struct.TryWriteableInfallibleAsWriteable.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=../../writeable/adapters/struct.WriteableAsTryWriteableInfallible.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/adapters/struct.WriteableAsTryWriteableInfallible.html">../../writeable/adapters/struct.WriteableAsTryWriteableInfallible.html</a>...</p>
<script>location.replace("../../writeable/adapters/struct.WriteableAsTryWriteableInfallible.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=../../writeable/trait.TryWriteable.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../writeable/trait.TryWriteable.html">../../writeable/trait.TryWriteable.html</a>...</p>
<script>location.replace("../../writeable/trait.TryWriteable.html" + location.search + location.hash);</script>
</body>
</html>