index.html 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Rust mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="rust.js"></script>
  9. <link rel="stylesheet" href="../../doc/docs.css">
  10. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  11. </head>
  12. <body>
  13. <h1>CodeMirror: Rust mode</h1>
  14. <div><textarea id="code" name="code">
  15. // Demo code.
  16. type foo<T> = int;
  17. enum bar {
  18. some(int, foo<float>),
  19. none
  20. }
  21. fn check_crate(x: int) {
  22. let v = 10;
  23. alt foo {
  24. 1 to 3 {
  25. print_foo();
  26. if x {
  27. blah() + 10;
  28. }
  29. }
  30. (x, y) { "bye" }
  31. _ { "hi" }
  32. }
  33. }
  34. </textarea></div>
  35. <script>
  36. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  37. lineNumbers: true,
  38. tabMode: "indent"
  39. });
  40. </script>
  41. <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
  42. </body>
  43. </html>