File: prism-rust.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (49 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<h2>Comments</h2>
<pre><code>// Single line comment
/// Doc comments
/* Multiline
comment */</code></pre>

<h2>Strings</h2>
<pre><code>'C'; '\''; '\n'; '\u{7FFF}'; // Characters
"foo \"bar\" baz"; // String
r##"foo #"bar"# baz"##; // Raw string with # pairs
b'C'; b'\''; b'\n'; // Bytes
b"foo \"bar\" baz"; // Byte string
br##"foo #"bar"# baz"##; // Raw byte string with # pairs
</code></pre>

<h2>Numbers</h2>
<pre><code>0xff_u8;                           // type u8
0o70_i16;                          // type i16
0b1111_1111_1001_0000_i32;         // type i32

123.0f64;        // type f64
0.1f64;          // type f64
0.1f32;          // type f32
12E+99_f64;      // type f64
</code></pre>

<h2>Booleans</h2>
<pre><code>true; false;</code></pre>

<h2>Functions and macros</h2>
<pre><code>println!("x is {}", x);
fn next_two(x: i32) -> (i32, i32) { (x + 1, x + 2) }
next_two(5);
vec![1, 2, 3];
</code></pre>

<h2>Attributes</h2>
<pre><code>#![warn(unstable)]
#[test]
fn a_test() {
	// ...
}</code></pre>

<h2>Closure parameters and bitwise OR</h2>
<pre><code>let x = a | b;
let y = c || d;
let add_one = |x: i32| -> i32 { 1i + x };
let printer = || { println!("x is: {}", x); };
</code></pre>