Theme Inspinia
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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>