rust: add snippets for crate, pub fns, and constructor (#262)

This commit is contained in:
Balaji Sivaraman 2018-06-16 22:35:24 +05:30 committed by Andrea Crotti
parent 6a5f130397
commit c4bc16ea7b
6 changed files with 38 additions and 0 deletions

5
snippets/rust-mode/crate Normal file
View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: extern crate
# key: ec
# --
extern crate ${0:name};

7
snippets/rust-mode/new Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: fn main() { ... }
# key: new
# --
pub fn new($1) -> ${2:Name} {
$2 { ${3} }
}

7
snippets/rust-mode/pfn Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: pub fn name() { ... }
# key: pfn
# --
pub fn ${1:name}($2) {
$0
}

7
snippets/rust-mode/pfnr Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: pub fn name() -> Type { ... }
# key: pfnr
# --
pub fn ${1:name}($2) -> ${3:Type} {
$0
}

5
snippets/rust-mode/pfns Normal file
View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: pub fn name(&self) -> Type;
# key: pfns
# --
pub fn ${1:name}(${2:&self}) -> ${3:Type};

7
snippets/rust-mode/pfnw Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: pub fn name<T>(x: T) where T: Clone { ... }
# key: pfnw
# --
pub fn ${1:name}<${2:T}>(${3:x: T}) where ${4:T: Clone} {
$0
}