feat: added cleanscript

This commit is contained in:
2026-06-22 21:27:36 +05:30
parent dbddc0ce2d
commit 4581eea409
309 changed files with 14551 additions and 46035 deletions

View File

@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A - Keywords</title>
</head>
<body>
<h2 id="appendix-a-keywords"><a class="header" href="#appendix-a-keywords">Appendix A: Keywords</a></h2>
<p>The following lists contain keywords that are reserved for current or future
use by the Rust language. As such, they cannot be used as identifiers (except
as raw identifiers, as we discuss in the <a href="#raw-identifiers">“Raw
Identifiers”</a><!-- ignore --> section). <em>Identifiers</em> are names
of functions, variables, parameters, struct fields, modules, crates, constants,
macros, static values, attributes, types, traits, or lifetimes.</p>
<h3 id="keywords-currently-in-use"><a class="header" href="#keywords-currently-in-use">Keywords Currently in Use</a></h3>
<p>The following is a list of keywords currently in use, with their functionality
described.</p>
<ul>
<li><strong><code>as</code></strong>: Perform primitive casting, disambiguate the specific trait
containing an item, or rename items in <code>use</code> statements.</li>
<li><strong><code>async</code></strong>: Return a <code>Future</code> instead of blocking the current thread.</li>
<li><strong><code>await</code></strong>: Suspend execution until the result of a <code>Future</code> is ready.</li>
<li><strong><code>break</code></strong>: Exit a loop immediately.</li>
<li><strong><code>const</code></strong>: Define constant items or constant raw pointers.</li>
<li><strong><code>continue</code></strong>: Continue to the next loop iteration.</li>
<li><strong><code>crate</code></strong>: In a module path, refers to the crate root.</li>
<li><strong><code>dyn</code></strong>: Dynamic dispatch to a trait object.</li>
<li><strong><code>else</code></strong>: Fallback for <code>if</code> and <code>if let</code> control flow constructs.</li>
<li><strong><code>enum</code></strong>: Define an enumeration.</li>
<li><strong><code>extern</code></strong>: Link an external function or variable.</li>
<li><strong><code>false</code></strong>: Boolean false literal.</li>
<li><strong><code>fn</code></strong>: Define a function or the function pointer type.</li>
<li><strong><code>for</code></strong>: Loop over items from an iterator, implement a trait, or specify a
higher ranked lifetime.</li>
<li><strong><code>if</code></strong>: Branch based on the result of a conditional expression.</li>
<li><strong><code>impl</code></strong>: Implement inherent or trait functionality.</li>
<li><strong><code>in</code></strong>: Part of <code>for</code> loop syntax.</li>
<li><strong><code>let</code></strong>: Bind a variable.</li>
<li><strong><code>loop</code></strong>: Loop unconditionally.</li>
<li><strong><code>match</code></strong>: Match a value to patterns.</li>
<li><strong><code>mod</code></strong>: Define a module.</li>
<li><strong><code>move</code></strong>: Make a closure take ownership of all its captures.</li>
<li><strong><code>mut</code></strong>: Denote mutability in references, raw pointers, or pattern bindings.</li>
<li><strong><code>pub</code></strong>: Denote public visibility in struct fields, <code>impl</code> blocks, or
modules.</li>
<li><strong><code>ref</code></strong>: Bind by reference.</li>
<li><strong><code>return</code></strong>: Return from function.</li>
<li><strong><code>Self</code></strong>: A type alias for the type we are defining or implementing.</li>
<li><strong><code>self</code></strong>: Method subject or current module.</li>
<li><strong><code>static</code></strong>: Global variable or lifetime lasting the entire program
execution.</li>
<li><strong><code>struct</code></strong>: Define a structure.</li>
<li><strong><code>super</code></strong>: Parent module of the current module.</li>
<li><strong><code>trait</code></strong>: Define a trait.</li>
<li><strong><code>true</code></strong>: Boolean true literal.</li>
<li><strong><code>type</code></strong>: Define a type alias or associated type.</li>
<li><strong><code>union</code></strong>: Define a <a href="../reference/items/unions.html">union</a><!-- ignore -->; is a keyword only when
used in a union declaration.</li>
<li><strong><code>unsafe</code></strong>: Denote unsafe code, functions, traits, or implementations.</li>
<li><strong><code>use</code></strong>: Bring symbols into scope.</li>
<li><strong><code>where</code></strong>: Denote clauses that constrain a type.</li>
<li><strong><code>while</code></strong>: Loop conditionally based on the result of an expression.</li>
</ul>
<h3 id="keywords-reserved-for-future-use"><a class="header" href="#keywords-reserved-for-future-use">Keywords Reserved for Future Use</a></h3>
<p>The following keywords do not yet have any functionality but are reserved by
Rust for potential future use:</p>
<ul>
<li><code>abstract</code></li>
<li><code>become</code></li>
<li><code>box</code></li>
<li><code>do</code></li>
<li><code>final</code></li>
<li><code>gen</code></li>
<li><code>macro</code></li>
<li><code>override</code></li>
<li><code>priv</code></li>
<li><code>try</code></li>
<li><code>typeof</code></li>
<li><code>unsized</code></li>
<li><code>virtual</code></li>
<li><code>yield</code></li>
</ul>
<h3 id="raw-identifiers"><a class="header" href="#raw-identifiers">Raw Identifiers</a></h3>
<p><em>Raw identifiers</em> are the syntax that lets you use keywords where they wouldnt
normally be allowed. You use a raw identifier by prefixing a keyword with <code>r#</code>.</p>
<p>For example, <code>match</code> is a keyword. If you try to compile the following function
that uses <code>match</code> as its name:</p>
<p><span class="filename">Filename: src/main.rs</span></p>
<pre><code class="language-rust ignore does_not_compile">fn match(needle: &amp;str, haystack: &amp;str) -&gt; bool {
haystack.contains(needle)
}</code></pre>
<p>youll get this error:</p>
<pre><code class="language-text">error: expected identifier, found keyword `match`
--&gt; src/main.rs:4:4
|
4 | fn match(needle: &amp;str, haystack: &amp;str) -&gt; bool {
| ^^^^^ expected identifier, found keyword
</code></pre>
<p>The error shows that you cant use the keyword <code>match</code> as the function
identifier. To use <code>match</code> as a function name, you need to use the raw
identifier syntax, like this:</p>
<p><span class="filename">Filename: src/main.rs</span></p>
<pre class="playground"><code class="language-rust edition2024">fn r#match(needle: &amp;str, haystack: &amp;str) -&gt; bool {
haystack.contains(needle)
}
fn main() {
assert!(r#match("foo", "foobar"));
}</code></pre>
<p>This code will compile without any errors. Note the <code>r#</code> prefix on the function
name in its definition as well as where the function is called in <code>main</code>.</p>
<p>Raw identifiers allow you to use any word you choose as an identifier, even if
that word happens to be a reserved keyword. This gives us more freedom to choose
identifier names, as well as lets us integrate with programs written in a
language where these words arent keywords. In addition, raw identifiers allow
you to use libraries written in a different Rust edition than your crate uses.
For example, <code>try</code> isnt a keyword in the 2015 edition but is in the 2018, 2021,
and 2024 editions. If you depend on a library that is written using the 2015
edition and has a <code>try</code> function, youll need to use the raw identifier syntax,
<code>r#try</code> in this case, to call that function from your code on later editions.
See <a href="appendix-05-editions.html">Appendix E</a><!-- ignore --> for more information on editions.</p>
</body>
</html>