blob: 8b76488a8bba20c965d2950afe01380739dbc388 [file] [log] [blame] [edit]
<!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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-84e720fa.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.89.0 (29483883e 2025-08-04)" data-channel="1.89.0" data-search-js="search-92309212.js" data-settings-js="settings-5514c975.js" ><script src="../static.files/storage-4e99c027.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-fd3af306.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><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="#structs">Crate Items</a></h3><ul class="block"><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><li><a href="#types" title="Type Aliases">Type Aliases</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"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>span</span><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-205">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="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.SpanAnchor.html" title="struct span::SpanAnchor">Span<wbr>Anchor</a></dt><dt><a class="struct" href="struct.SpanData.html" title="struct span::SpanData">Span<wbr>Data</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.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.</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><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.Span.html" title="type span::Span">Span</a></dt></dl></section></div></main></body></html>