Files
mindoc/static/editor.md/lib/codemirror/mode/rust/index.html

65 lines
1.5 KiB
HTML
Raw Normal View History

2017-04-26 18:17:38 +08:00
<!doctype html>
<title>CodeMirror: Rust mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
2024-03-27 16:26:01 +08:00
<script src="../../addon/mode/simple.js"></script>
2017-04-26 18:17:38 +08:00
<script src="rust.js"></script>
2024-03-27 16:26:01 +08:00
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
2017-04-26 18:17:38 +08:00
<div id=nav>
2024-03-27 16:26:01 +08:00
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
2017-04-26 18:17:38 +08:00
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Rust</a>
</ul>
</div>
<article>
<h2>Rust mode</h2>
<div><textarea id="code" name="code">
// Demo code.
2024-03-27 16:26:01 +08:00
type foo<T> = i32;
2017-04-26 18:17:38 +08:00
enum bar {
2024-03-27 16:26:01 +08:00
Some(i32, foo<f32>),
None
2017-04-26 18:17:38 +08:00
}
2024-03-27 16:26:01 +08:00
fn check_crate(x: i32) {
2017-04-26 18:17:38 +08:00
let v = 10;
2024-03-27 16:26:01 +08:00
match foo {
1 ... 3 {
print_foo();
if x {
blah().to_string();
}
2017-04-26 18:17:38 +08:00
}
2024-03-27 16:26:01 +08:00
(x, y) { "bye" }
_ { "hi" }
2017-04-26 18:17:38 +08:00
}
}
</textarea></div>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
2024-03-27 16:26:01 +08:00
lineNumbers: true,
lineWrapping: true,
indentUnit: 4,
mode: "rust"
2017-04-26 18:17:38 +08:00
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
</article>