| <!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="API documentation for the Rust `Span` type in crate `span`."><title>Span in 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-e56847b5.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.91.1 (ed61e7d7e 2025-11-07)" data-channel="1.91.1" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-c3e638e9.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-6dc2a7f3.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 type"><!--[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="#">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"><section id="rustdoc-toc"><h2 class="location"><a href="#">Span</a></h2><h3><a href="#aliased-type">Aliased Type</a></h3><h3><a href="#fields">Fields</a></h3><ul class="block field"><li><a href="#structfield.anchor" title="anchor">anchor</a></li><li><a href="#structfield.ctx" title="ctx">ctx</a></li><li><a href="#structfield.range" title="range">range</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.cover" title="cover">cover</a></li><li><a href="#method.join" title="join">join</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Display-for-SpanData%3CSyntaxContext%3E" title="Display">Display</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate span</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">span</a></div><h1>Type Alias <span class="type">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#21">Source</a> </span></div><pre class="rust item-decl"><code>pub type Span = <a class="struct" href="struct.SpanData.html" title="struct span::SpanData">SpanData</a><<a class="struct" href="struct.SyntaxContext.html" title="struct span::SyntaxContext">SyntaxContext</a>>;</code></pre><h2 id="aliased-type" class="section-header">Aliased Type<a href="#aliased-type" class="anchor">§</a></h2><pre class="rust item-decl"><code>pub struct Span { |
| pub range: <a class="struct" href="struct.TextRange.html" title="struct span::TextRange">TextRange</a>, |
| pub anchor: <a class="struct" href="struct.SpanAnchor.html" title="struct span::SpanAnchor">SpanAnchor</a>, |
| pub ctx: <a class="struct" href="struct.SyntaxContext.html" title="struct span::SyntaxContext">SyntaxContext</a>, |
| }</code></pre><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.range" class="structfield section-header"><a href="#structfield.range" class="anchor field">§</a><code>range: <a class="struct" href="struct.TextRange.html" title="struct span::TextRange">TextRange</a></code></span><div class="docblock"><p>The text range of this span, relative to the anchor. |
| We need the anchor for incrementality, as storing absolute ranges will require |
| recomputation on every change in a file at all times.</p> |
| </div><span id="structfield.anchor" class="structfield section-header"><a href="#structfield.anchor" class="anchor field">§</a><code>anchor: <a class="struct" href="struct.SpanAnchor.html" title="struct span::SpanAnchor">SpanAnchor</a></code></span><div class="docblock"><p>The anchor this span is relative to.</p> |
| </div><span id="structfield.ctx" class="structfield section-header"><a href="#structfield.ctx" class="anchor field">§</a><code>ctx: <a class="struct" href="struct.SyntaxContext.html" title="struct span::SyntaxContext">SyntaxContext</a></code></span><div class="docblock"><p>The syntax context of the span.</p> |
| </div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-SpanData%3CSyntaxContext%3E" class="impl"><a class="src rightside" href="../src/span/lib.rs.html#23-58">Source</a><a href="#impl-SpanData%3CSyntaxContext%3E" class="anchor">§</a><h3 class="code-header">impl <a class="type" href="type.Span.html" title="type span::Span">Span</a></h3></section></summary><div class="impl-items"><section id="method.cover" class="method"><a class="src rightside" href="../src/span/lib.rs.html#24-30">Source</a><h4 class="code-header">pub fn <a href="#method.cover" class="fn">cover</a>(self, other: <a class="type" href="type.Span.html" title="type span::Span">Span</a>) -> <a class="type" href="type.Span.html" title="type span::Span">Span</a></h4></section><section id="method.join" class="method"><a class="src rightside" href="../src/span/lib.rs.html#32-57">Source</a><h4 class="code-header">pub fn <a href="#method.join" class="fn">join</a>( |
| self, |
| other: <a class="type" href="type.Span.html" title="type span::Span">Span</a>, |
| differing_anchor: impl <a class="trait" href="https://doc.rust-lang.org/1.91.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="type" href="type.Span.html" title="type span::Span">Span</a>, <a class="type" href="type.Span.html" title="type span::Span">Span</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.91.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="type" href="type.Span.html" title="type span::Span">Span</a>>, |
| ) -> <a class="enum" href="https://doc.rust-lang.org/1.91.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="type" href="type.Span.html" title="type span::Span">Span</a>></h4></section></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-SpanData%3CSyntaxContext%3E" class="impl"><a class="src rightside" href="../src/span/lib.rs.html#101-111">Source</a><a href="#impl-Display-for-SpanData%3CSyntaxContext%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.91.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="type" href="type.Span.html" title="type span::Span">Span</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/span/lib.rs.html#102-110">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.91.1/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.91.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.91.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.91.1/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details></div><script src="../type.impl/span/struct.SpanData.js" data-self-path="span::Span" async></script></section></div></main></body></html> |