/usr/share/vim/addons/UltiSnips/rust.snippets is in vim-snippets 1.0.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | #######################################################################
# Rust Snippets #
#######################################################################
priority -50
###############
# Functions #
###############
snippet fn "A function, optionally with arguments and return type." b
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
${VISUAL}${0}
}
endsnippet
snippet test "Test function" b
#[test]
fn ${1:test_function_name}() {
${VISUAL}${0}
}
endsnippet
snippet new "A new function" b
pub fn new(${2}) -> ${1:Name} {
${VISUAL}${0}return $1 { ${3} };
}
endsnippet
snippet main "The main function" b
pub fn main() {
${VISUAL}${0}
}
endsnippet
snippet let "A let statement" b
let ${1:name}${3} = ${VISUAL}${2};
endsnippet
snippet pln "println!(..)" b
println!("${1}"${2/..*/, /}${2});
endsnippet
snippet ec "extern crate ..." b
extern crate ${1:sync};
endsnippet
snippet ecl "...extern crate log;" b
#![feature(phase)]
#[phase(syntax, link)] extern crate log;
endsnippet
snippet mod "A mod." b
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
${VISUAL}${0}
} /* $1 */
endsnippet
snippet crate "Create header information" b
// Crate ID
#![crate_id = "${1:crate_name}#${2:0.0.1}"]
// Additional metadata attributes
#![desc = "${3:Descrption.}"]
#![license = "${4:BSD}"]
#![comment = "${5:Comment.}"]
// Specify the output type
#![crate_type = "${6:lib}"]
endsnippet
snippet allow "#[allow(..)]" b
#[allow(${1:unused_variable})]
endsnippet
snippet feat "#![feature(..)]" b
#![feature(${1:macro_rules})]
endsnippet
##################
# Common types #
##################
snippet opt "Option<..>"
Option<${1:int}>
endsnippet
snippet res "Result<.., ..>"
Result<${1:~str}, ${2:()}>
endsnippet
snippet if "if .. (if)" b
if ${1:/* condition */} {
${VISUAL}${0}
}
endsnippet
snippet mat "match"
match ${1} {
${2} => ${3},
}
endsnippet
snippet while "while .. {}" b
while ${1:condition} {
${VISUAL}${0}
}
endsnippet
snippet for "for .. in .." b
for ${1:i} in ${2:range(0u, 10)} {
${VISUAL}${0}
}
endsnippet
snippet spawn "spawn(proc() { .. });" b
spawn(proc() {
${VISUAL}${0}
});
endsnippet
snippet chan "A channel" b
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
endsnippet
snippet duplex "Duplex stream" b
let (${1:from_child}, ${2:to_child}) = sync::duplex();
endsnippet
#####################
# TODO commenting #
#####################
snippet todo "A Todo comment"
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
endsnippet
############
# Struct #
############
snippet st "Struct" b
struct ${1:`!p snip.rv = snip.basename.title() or "name"`} {
${VISUAL}${0}
}
endsnippet
snippet stn "Struct with new constructor." b
pub struct ${1:`!p snip.rv = snip.basename.title() or "name"`} {
${3}
}
impl $1 {
pub fn new(${2}) -> $1 {
${4}return $1 {
${5}
};
}
}
endsnippet
##########
# Enum #
##########
snippet enum "An enum" b
enum ${1:enum_name} {
${VISUAL}${0},
}
endsnippet
##########
# Impl #
##########
snippet imp "An impl" b
impl ${1:Name} {
${VISUAL}${0}
}
endsnippet
snippet drop "Drop implementation" b
impl Drop for ${1:Name} {
fn drop(&mut self) {
${VISUAL}${0}
}
}
endsnippet
############
# Traits #
############
snippet trait "Trait block" b
trait ${1:Name} {
${VISUAL}${0}
}
endsnippet
#############
# Statics #
#############
snippet ss "A static string."
static ${1}: &'static str = "${VISUAL}${0}";
endsnippet
snippet stat "A static variable."
static ${1}: ${2:uint} = ${VISUAL}${0};
endsnippet
# vim:ft=snippets:
|