rust-analyzer/span/index.html
2026-01-16 07:39:25 +00:00

19 lines
9.2 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="File and span related types."><title>span - 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="span" 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 span</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../span/index.html">span</a><span class="version">0.0.0</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="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</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>span</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/span/lib.rs.html#1-234">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>File and span related types.</p>
</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="ast_id/index.html" title="mod span::ast_id">ast_id</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd><code>AstIdMap</code> allows to create stable IDs for “large” syntax nodes like items
and macro calls.</dd><dt><a class="mod" href="hygiene/index.html" title="mod span::hygiene">hygiene</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Machinery for hygienic macros.</dd><dt><a class="mod" href="map/index.html" title="mod span::map">map</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>A map that maps a span to every position in a file. Usually maps a span to some range of positions.
Allows bidirectional lookup.</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.AstIdMap.html" title="struct span::AstIdMap">AstId<wbr>Map</a></dt><dd>Maps items <code>SyntaxNode</code>s to <code>ErasedFileAstId</code>s and back.</dd><dt><a class="struct" href="struct.EditionedFileId.html" title="struct span::EditionedFileId">Editioned<wbr>File<wbr>Id</a></dt><dd>A <a href="struct.FileId.html" title="struct span::FileId"><code>FileId</code></a> and <a href="enum.Edition.html" title="enum span::Edition"><code>Edition</code></a> bundled up together.
The MSB is reserved for <code>HirFileId</code> encoding, more upper bits are used to then encode the edition.</dd><dt><a class="struct" href="struct.ErasedFileAstId.html" title="struct span::ErasedFileAstId">Erased<wbr>File<wbr>AstId</a></dt><dd>This is a type erased FileAstId.</dd><dt><a class="struct" href="struct.FileAstId.html" title="struct span::FileAstId">File<wbr>AstId</a></dt><dd><code>AstId</code> points to an AST node in a specific file.</dd><dt><a class="struct" href="struct.FileId.html" title="struct span::FileId">FileId</a></dt><dd>Handle to a file in [<code>Vfs</code>]</dd><dt><a class="struct" href="struct.HirFileId.html" title="struct span::HirFileId">HirFile<wbr>Id</a></dt><dd>Input to the analyzer is a set of files, where each file is identified by
<code>FileId</code> and contains source code. However, another source of source code in
Rust are macros: each macro can be thought of as producing a “temporary
file”. To assign an id to such a file, we use the id of the macro call that
produced the file. So, a <code>HirFileId</code> is either a <code>FileId</code> (source code
written by user), or a <code>MacroCallId</code> (source code produced by macro).</dd><dt><a class="struct" href="struct.MacroCallId.html" title="struct span::MacroCallId">Macro<wbr>Call<wbr>Id</a></dt><dd><code>MacroCallId</code> identifies a particular macro invocation, like
<code>println!("Hello, {}", world)</code>.</dd><dt><a class="struct" href="struct.RealSpanMap.html" title="struct span::RealSpanMap">Real<wbr>Span<wbr>Map</a></dt><dt><a class="struct" href="struct.Span.html" title="struct span::Span">Span</a></dt><dd>Spans represent a region of code, used by the IDE to be able link macro inputs and outputs
together. Positions in spans are relative to some <a href="struct.SpanAnchor.html" title="struct span::SpanAnchor"><code>SpanAnchor</code></a> to make them more incremental
friendly.</dd><dt><a class="struct" href="struct.SpanAnchor.html" title="struct span::SpanAnchor">Span<wbr>Anchor</a></dt><dt><a class="struct" href="struct.SpanMap.html" title="struct span::SpanMap">SpanMap</a></dt><dd>Maps absolute text ranges for the corresponding file to the relevant span data.</dd><dt><a class="struct" href="struct.SyntaxContext.html" title="struct span::SyntaxContext">Syntax<wbr>Context</a></dt><dd>A syntax context describes a hierarchy tracking order of macro definitions.</dd><dt><a class="struct" href="struct.TextRange.html" title="struct span::TextRange">Text<wbr>Range</a></dt><dd>A range in text, represented as a pair of <a href="struct.TextSize.html" title="struct span::TextSize"><code>TextSize</code></a>.</dd><dt><a class="struct" href="struct.TextSize.html" title="struct span::TextSize">Text<wbr>Size</a></dt><dd>A measure of text length. Also, equivalently, an index into text.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Edition.html" title="enum span::Edition">Edition</a></dt><dt><a class="enum" href="enum.Transparency.html" title="enum span::Transparency">Transparency</a></dt><dd>A property of a macro expansion that determines how identifiers
produced by that expansion are resolved.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.FIXUP_ERASED_FILE_AST_ID_MARKER.html" title="constant span::FIXUP_ERASED_FILE_AST_ID_MARKER">FIXUP_<wbr>ERASED_<wbr>FILE_<wbr>AST_<wbr>ID_<wbr>MARKER</a></dt><dd>ErasedFileAstId used as the span for syntax node fixups. Any Span containing this file id is to be
considered fake.
Do not modify this, it is used by the proc-macro server.</dd><dt><a class="constant" href="constant.NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER.html" title="constant span::NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER">NO_<wbr>DOWNMAP_<wbr>ERASED_<wbr>FILE_<wbr>AST_<wbr>ID_<wbr>MARKER</a></dt><dd><a href="struct.ErasedFileAstId.html" title="struct span::ErasedFileAstId"><code>ErasedFileAstId</code></a> used as the span for syntax nodes that should not be mapped down to
macro expansion. Any <code>Span</code> containing this file id is to be considered fake.</dd><dt><a class="constant" href="constant.ROOT_ERASED_FILE_AST_ID.html" title="constant span::ROOT_ERASED_FILE_AST_ID">ROOT_<wbr>ERASED_<wbr>FILE_<wbr>AST_<wbr>ID</a></dt><dd>The root ast id always points to the encompassing file, using this in spans is discouraged as
any range relative to it will be effectively absolute, ruining the entire point of anchored
relative text ranges.</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.AstIdNode.html" title="trait span::AstIdNode">AstId<wbr>Node</a></dt></dl></section></div></main></body></html>