Rust: pub fn, correct while trigger

This commit is contained in:
Louis Pilfold 2015-08-02 12:56:54 +01:00
parent 814896e4d2
commit af3c2d3f66
2 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,12 @@ fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
} }
endsnippet endsnippet
snippet pfn "A public function, optionally with arguments and return type."
pub fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
${VISUAL}${0}
}
endsnippet
snippet arg "Function Arguments" i snippet arg "Function Arguments" i
${1:a}: ${2:T}${3:, arg} ${1:a}: ${2:T}${3:, arg}
endsnippet endsnippet

View File

@ -7,6 +7,10 @@ snippet fn "Function definition"
fn ${1:function_name}(${2})${3} { fn ${1:function_name}(${2})${3} {
${0} ${0}
} }
snippet pfn "Function definition"
pub fn ${1:function_name}(${2})${3} {
${0}
}
snippet test "Unit test function" snippet test "Unit test function"
#[test] #[test]
fn ${1:test_function_name}() { fn ${1:test_function_name}() {
@ -106,7 +110,7 @@ snippet loop "loop {}" b
loop { loop {
${0} ${0}
} }
snippet while "while loop" snippet wh "while loop"
while ${1:condition} { while ${1:condition} {
${0} ${0}
} }