mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-04 10:50:15 +00:00
20 lines
No EOL
4.2 KiB
HTML
20 lines
No EOL
4.2 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="Extracts `//^^^ some text` annotations."><title>extract_annotations in test_utils - 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-1a91846b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="test_utils" data-themes="" data-resource-suffix="" data-rustdoc-version="1.88.0 (6b00bc388 2025-06-23)" data-channel="1.88.0" data-search-js="search-f7877310.js" data-settings-js="settings-5514c975.js" ><script src="../static.files/storage-4e99c027.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-7ef8a74a.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.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 fn"><!--[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="../test_utils/index.html">test_<wbr>utils</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">test_utils</a></div><h1>Function <span class="fn">extract_annotations</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/test_utils/lib.rs.html#233-284">Source</a> </span></div><pre class="rust item-decl"><code>pub fn extract_annotations(text: &<a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><(TextRange, <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extracts <code>//^^^ some text</code> annotations.</p>
|
|
<p>A run of <code>^^^</code> can be arbitrary long and points to the corresponding range
|
|
in the line above.</p>
|
|
<p>The <code>// ^file text</code> syntax can be used to attach <code>text</code> to the entirety of
|
|
the file.</p>
|
|
<p>Multiline string values are supported:</p>
|
|
<p>// ^^^ first line
|
|
// | second line</p>
|
|
<p>Trailing whitespace is sometimes desired but usually stripped by the editor
|
|
if at the end of a line, or incorrectly sized if followed by another
|
|
annotation. In those cases the annotation can be explicitly ended with the
|
|
<code>$</code> character.</p>
|
|
<p>// ^^^ trailing-ws-wanted $</p>
|
|
<p>Annotations point to the last line that actually was long enough for the
|
|
range, not counting annotations themselves. So overlapping annotations are
|
|
possible:</p>
|
|
<div class="example-wrap"><pre class="language-text"><code>// stuff other stuff
|
|
// ^^ 'st'
|
|
// ^^^^^ 'stuff'
|
|
// ^^^^^^^^^^^ 'other stuff'</code></pre></div></div></details></section></div></main></body></html> |