| 📦 Turbo Rust 713ea5c k33g 10h ago | 1 | # turbo-rust snippets. |
| 2 | # |
| 3 | # Each [[snippet]] becomes one line of the Snippets menu. Snippets sharing a |
| 4 | # group appear together in a submenu of that name; one with no group goes into |
| 5 | # %s. A snippet is inserted at the cursor, and every line after the |
| 6 | # first is indented to match the line you inserted it on. |
| 7 | # |
| 8 | # languages restricts a snippet to files of those kinds, by the names the |
| 9 | # editor uses: rust, toml, yaml, markdown, javascript, html, xml, dockerfile, |
| 10 | # bash. Leave it out and the snippet is offered everywhere. |
| 11 | # |
| 12 | # Your own snippets, shared across every project, go in: |
| 13 | # %s |
| 14 | |
| 15 | [[snippet]] |
| 16 | name = "match" |
| 17 | group = "Rust" |
| 18 | languages = ["rust"] |
| 19 | body = """ |
| 20 | match value { |
| 21 | Some(v) => v, |
| 22 | None => return, |
| 23 | }""" |
| 24 | |
| 25 | [[snippet]] |
| 26 | name = "if let" |
| 27 | group = "Rust" |
| 28 | languages = ["rust"] |
| 29 | body = """ |
| 30 | if let Some(v) = value { |
| 31 | }""" |
| 32 | |
| 33 | [[snippet]] |
| 34 | name = "propagate the error" |
| 35 | group = "Rust" |
| 36 | languages = ["rust"] |
| 37 | body = "let value = fallible()?;" |
| 38 | |
| 39 | [[snippet]] |
| 40 | name = "derive" |
| 41 | group = "Rust" |
| 42 | languages = ["rust"] |
| 43 | body = "#[derive(Debug, Clone, PartialEq)]" |
| 44 | |
| 45 | [[snippet]] |
| 46 | name = "test module" |
| 47 | group = "Rust" |
| 48 | languages = ["rust"] |
| 49 | body = """ |
| 50 | #[cfg(test)] |
| 51 | mod tests { |
| 52 | use super::*; |
| 53 | |
| 54 | #[test] |
| 55 | fn it_works() { |
| 56 | assert_eq!(1 + 1, 2); |
| 57 | } |
| 58 | }""" |
| 59 | |
| 60 | [[snippet]] |
| 61 | group = "General" |
| 62 | name = "Hello" |
| 63 | body = "Hello!!!" |
| 64 | |
| 65 | [[snippet]] |
| 66 | group = "Markdown" |
| 67 | name = "Image" |
| 68 | languages = ["markdown"] |
| 69 | body = "" |