index.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!doctype html>
  2. <title>CodeMirror: Rust mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="rust.js"></script>
  8. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">Rust</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Rust mode</h2>
  23. <div><textarea id="code" name="code">
  24. // Demo code.
  25. type foo<T> = int;
  26. enum bar {
  27. some(int, foo<float>),
  28. none
  29. }
  30. fn check_crate(x: int) {
  31. let v = 10;
  32. alt foo {
  33. 1 to 3 {
  34. print_foo();
  35. if x {
  36. blah() + 10;
  37. }
  38. }
  39. (x, y) { "bye" }
  40. _ { "hi" }
  41. }
  42. }
  43. </textarea></div>
  44. <script>
  45. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  46. lineNumbers: true
  47. });
  48. </script>
  49. <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
  50. </article>