rust-analyzer/syntax/ast/trait.AstToken.html
github-merge-queue[bot] cddc2a952f deploy: 9923b0085c
2025-01-11 06:35:13 +00:00

14 lines
No EOL
12 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="Like `AstNode`, but wraps tokens rather than interior nodes."><title>AstToken in syntax::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="syntax" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 trait"><!--[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="../../syntax/index.html">syntax</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">AstToken</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.can_cast" title="can_cast">can_cast</a></li><li><a href="#tymethod.cast" title="cast">cast</a></li><li><a href="#tymethod.syntax" title="syntax">syntax</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.text" title="text">text</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In syntax::<wbr>ast</a></h2></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"><span class="rustdoc-breadcrumbs"><a href="../index.html">syntax</a>::<wbr><a href="index.html">ast</a></span><h1>Trait <span class="trait">AstToken</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/syntax/ast.rs.html#77-91">Source</a> </span></div><pre class="rust item-decl"><code>pub trait AstToken {
// Required methods
fn <a href="#tymethod.can_cast" class="fn">can_cast</a>(token: <a class="enum" href="../enum.SyntaxKind.html" title="enum syntax::SyntaxKind">SyntaxKind</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.cast" class="fn">cast</a>(syntax: <a class="type" href="../type.SyntaxToken.html" title="type syntax::SyntaxToken">SyntaxToken</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.syntax" class="fn">syntax</a>(&amp;self) -&gt; &amp;<a class="type" href="../type.SyntaxToken.html" title="type syntax::SyntaxToken">SyntaxToken</a>;
// Provided method
fn <a href="#method.text" class="fn">text</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.str.html">str</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Like <code>AstNode</code>, but wraps tokens rather than interior nodes.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><section id="tymethod.can_cast" class="method"><a class="src rightside" href="../../src/syntax/ast.rs.html#78-80">Source</a><h4 class="code-header">fn <a href="#tymethod.can_cast" class="fn">can_cast</a>(token: <a class="enum" href="../enum.SyntaxKind.html" title="enum syntax::SyntaxKind">SyntaxKind</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><section id="tymethod.cast" class="method"><a class="src rightside" href="../../src/syntax/ast.rs.html#82-84">Source</a><h4 class="code-header">fn <a href="#tymethod.cast" class="fn">cast</a>(syntax: <a class="type" href="../type.SyntaxToken.html" title="type syntax::SyntaxToken">SyntaxToken</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><section id="tymethod.syntax" class="method"><a class="src rightside" href="../../src/syntax/ast.rs.html#86">Source</a><h4 class="code-header">fn <a href="#tymethod.syntax" class="fn">syntax</a>(&amp;self) -&gt; &amp;<a class="type" href="../type.SyntaxToken.html" title="type syntax::SyntaxToken">SyntaxToken</a></h4></section></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><section id="method.text" class="method"><a class="src rightside" href="../../src/syntax/ast.rs.html#88-90">Source</a><h4 class="code-header">fn <a href="#method.text" class="fn">text</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.str.html">str</a></h4></section></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AstToken-for-Byte" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#18-28">Source</a><a href="#impl-AstToken-for-Byte" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.Byte.html" title="struct syntax::ast::Byte">Byte</a></h3></section><section id="impl-AstToken-for-ByteString" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#39-49">Source</a><a href="#impl-AstToken-for-ByteString" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.ByteString.html" title="struct syntax::ast::ByteString">ByteString</a></h3></section><section id="impl-AstToken-for-CString" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#60-70">Source</a><a href="#impl-AstToken-for-CString" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.CString.html" title="struct syntax::ast::CString">CString</a></h3></section><section id="impl-AstToken-for-Char" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#81-91">Source</a><a href="#impl-AstToken-for-Char" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.Char.html" title="struct syntax::ast::Char">Char</a></h3></section><section id="impl-AstToken-for-Comment" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#102-112">Source</a><a href="#impl-AstToken-for-Comment" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.Comment.html" title="struct syntax::ast::Comment">Comment</a></h3></section><section id="impl-AstToken-for-FloatNumber" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#123-133">Source</a><a href="#impl-AstToken-for-FloatNumber" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.FloatNumber.html" title="struct syntax::ast::FloatNumber">FloatNumber</a></h3></section><section id="impl-AstToken-for-Ident" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#144-154">Source</a><a href="#impl-AstToken-for-Ident" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.Ident.html" title="struct syntax::ast::Ident">Ident</a></h3></section><section id="impl-AstToken-for-IntNumber" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#165-175">Source</a><a href="#impl-AstToken-for-IntNumber" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.IntNumber.html" title="struct syntax::ast::IntNumber">IntNumber</a></h3></section><section id="impl-AstToken-for-String" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#186-196">Source</a><a href="#impl-AstToken-for-String" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.String.html" title="struct syntax::ast::String">String</a></h3></section><section id="impl-AstToken-for-Whitespace" class="impl"><a class="src rightside" href="../../src/syntax/ast/generated/tokens.rs.html#207-217">Source</a><a href="#impl-AstToken-for-Whitespace" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AstToken.html" title="trait syntax::ast::AstToken">AstToken</a> for <a class="struct" href="struct.Whitespace.html" title="struct syntax::ast::Whitespace">Whitespace</a></h3></section></div><script src="../../trait.impl/syntax/ast/trait.AstToken.js" async></script></section></div></main></body></html>