60 lines
765 B
Plaintext
60 lines
765 B
Plaintext
snippet helloworld "Hello world example" b
|
|
// @name main
|
|
// @return
|
|
// @brief Hello world example.
|
|
// @param
|
|
fn main() {
|
|
println!("Hello World!");
|
|
}
|
|
$0
|
|
endsnippet
|
|
|
|
snippet fn "function declaration" i
|
|
// @name $1
|
|
// @return $3
|
|
// @brief ${4:Description}
|
|
// @param $2
|
|
fn $1($2) `!p
|
|
if t[3] == "":
|
|
snip.rv = ""
|
|
else:
|
|
snip.rv = " -> "` $3 {
|
|
$5
|
|
}
|
|
$0
|
|
endsnippet
|
|
|
|
snippet struct "struct declaration"
|
|
// $1
|
|
// ${2:Description}
|
|
struct ${1:Name} {
|
|
$3
|
|
}
|
|
$0
|
|
endsnippet
|
|
|
|
snippet impl "implement struct"
|
|
// Implementation of $1
|
|
// ${2:Desciption}
|
|
impl ${1:struct} {
|
|
$3
|
|
}
|
|
$0
|
|
endsnippet
|
|
|
|
snippet for "for-loop"
|
|
for ${1:i} in ${2:$3..$4} {
|
|
$5
|
|
}$0
|
|
endsnippet
|
|
|
|
snippet while "while loop"
|
|
while $1 {
|
|
$2
|
|
} $0
|
|
endsnippet
|
|
|
|
snippet println "println" A
|
|
println!("$1");$0
|
|
endsnippet
|