rust-analyzer/text_size/index.html
github-merge-queue[bot] b5b742c084 deploy: 624761a864
2025-12-22 13:59:51 +00:00

17 lines
No EOL
4.8 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Newtypes for working with text sizes/ranges in a more type-safe manner."><title>text_size - 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="text_size" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0 (ded5c06cf 2025-12-08)" data-channel="1.92.0" data-search-js="search-d69d8955.js" data-stringdex-js="stringdex-c3e638e9.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-ce535bd0.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 text_size</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../text_size/index.html">text_<wbr>size</a><span class="version">1.1.1</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="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</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>text_<wbr>size</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/text_size/lib.rs.html#1-32">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Newtypes for working with text sizes/ranges in a more type-safe manner.</p>
<p>This library can help with two things:</p>
<ul>
<li>Reducing storage requirements for offsets and ranges, under the
assumption that 32 bits is enough.</li>
<li>Providing standard vocabulary types for applications where text ranges
are pervasive.</li>
</ul>
<p>However, you should not use this library simply because you work with
strings. In the overwhelming majority of cases, using <code>usize</code> and
<code>std::ops::Range&lt;usize&gt;</code> is better. In particular, if you are publishing a
library, using only std types in the interface would make it more
interoperable. Similarly, if you are writing something like a lexer, which
produces, but does not <em>store</em> text ranges, then sticking to <code>usize</code> would
be better.</p>
<p>Minimal Supported Rust Version: latest stable.</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.TextRange.html" title="struct text_size::TextRange">Text<wbr>Range</a></dt><dd>A range in text, represented as a pair of <a href="struct.TextSize.html" title="struct text_size::TextSize"><code>TextSize</code></a>.</dd><dt><a class="struct" href="struct.TextSize.html" title="struct text_size::TextSize">Text<wbr>Size</a></dt><dd>A measure of text length. Also, equivalently, an index into text.</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.TextLen.html" title="trait text_size::TextLen">TextLen</a></dt><dd>Primitives with a textual length that can be passed to <a href="struct.TextSize.html#method.of" title="associated function text_size::TextSize::of"><code>TextSize::of</code></a>.</dd></dl></section></div></main></body></html>