143 lines
2.5 KiB
JSON
143 lines
2.5 KiB
JSON
{
|
|
"Function": {
|
|
"prefix": "fn",
|
|
"body": [
|
|
"fn $1($2) -> $3 {",
|
|
" $4",
|
|
"}"
|
|
],
|
|
"description": "Rust function"
|
|
},
|
|
"Public function": {
|
|
"prefix": "pubfn",
|
|
"body": [
|
|
"pub fn $1($2) -> $3 {",
|
|
" $4",
|
|
"}"
|
|
],
|
|
"description": "Rust public function"
|
|
},
|
|
"Main function": {
|
|
"prefix": "main",
|
|
"body": [
|
|
"fn main() {",
|
|
" $1",
|
|
"}"
|
|
],
|
|
"description": "Rust main function"
|
|
},
|
|
"Struct": {
|
|
"prefix": "struct",
|
|
"body": [
|
|
"struct $1 {",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Rust struct"
|
|
},
|
|
"Public struct": {
|
|
"prefix": "pubstruct",
|
|
"body": [
|
|
"pub struct $1 {",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Rust public struct"
|
|
},
|
|
"Enum": {
|
|
"prefix": "enum",
|
|
"body": [
|
|
"enum $1 {",
|
|
" $2,",
|
|
"}"
|
|
],
|
|
"description": "Rust enum"
|
|
},
|
|
"Impl block": {
|
|
"prefix": "impl",
|
|
"body": [
|
|
"impl $1 {",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Rust impl block"
|
|
},
|
|
"Match statement": {
|
|
"prefix": "match",
|
|
"body": [
|
|
"match $1 {",
|
|
" $2 => $3,",
|
|
" _ => $4,",
|
|
"}"
|
|
],
|
|
"description": "Rust match statement"
|
|
},
|
|
"If let": {
|
|
"prefix": "iflet",
|
|
"body": [
|
|
"if let $1 = $2 {",
|
|
" $3",
|
|
"}"
|
|
],
|
|
"description": "Rust if let"
|
|
},
|
|
"While let": {
|
|
"prefix": "whilelet",
|
|
"body": [
|
|
"while let $1 = $2 {",
|
|
" $3",
|
|
"}"
|
|
],
|
|
"description": "Rust while let"
|
|
},
|
|
"For loop": {
|
|
"prefix": "for",
|
|
"body": [
|
|
"for $1 in $2 {",
|
|
" $3",
|
|
"}"
|
|
],
|
|
"description": "Rust for loop"
|
|
},
|
|
"Test function": {
|
|
"prefix": "test",
|
|
"body": [
|
|
"#[test]",
|
|
"fn $1() {",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Rust test function"
|
|
},
|
|
"Derive": {
|
|
"prefix": "derive",
|
|
"body": ["#[derive($1)]"],
|
|
"description": "Rust derive attribute"
|
|
},
|
|
"Println": {
|
|
"prefix": "println",
|
|
"body": ["println!(\"$1\");"],
|
|
"description": "Rust println macro"
|
|
},
|
|
"Print": {
|
|
"prefix": "print",
|
|
"body": ["print!(\"$1\");"],
|
|
"description": "Rust print macro"
|
|
},
|
|
"Vec": {
|
|
"prefix": "vec",
|
|
"body": ["let $1: Vec<$2> = vec![$3];"],
|
|
"description": "Rust vector"
|
|
},
|
|
"Result": {
|
|
"prefix": "result",
|
|
"body": ["Result<$1, $2>"],
|
|
"description": "Rust Result type"
|
|
},
|
|
"Option": {
|
|
"prefix": "option",
|
|
"body": ["Option<$1>"],
|
|
"description": "Rust Option type"
|
|
}
|
|
}
|