From af3c2d3f66a6c7bf200f671ee76efdbad33ce69f Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sun, 2 Aug 2015 12:56:54 +0100 Subject: [PATCH] Rust: pub fn, correct while trigger --- UltiSnips/rust.snippets | 6 ++++++ snippets/rust.snippets | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/UltiSnips/rust.snippets b/UltiSnips/rust.snippets index 4a65d77..b377fa9 100644 --- a/UltiSnips/rust.snippets +++ b/UltiSnips/rust.snippets @@ -18,6 +18,12 @@ fn ${1:function_name}(${2})${3/..*/ -> /}${3} { } 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 ${1:a}: ${2:T}${3:, arg} endsnippet diff --git a/snippets/rust.snippets b/snippets/rust.snippets index c273f53..eeab689 100644 --- a/snippets/rust.snippets +++ b/snippets/rust.snippets @@ -7,6 +7,10 @@ snippet fn "Function definition" fn ${1:function_name}(${2})${3} { ${0} } +snippet pfn "Function definition" + pub fn ${1:function_name}(${2})${3} { + ${0} + } snippet test "Unit test function" #[test] fn ${1:test_function_name}() { @@ -106,7 +110,7 @@ snippet loop "loop {}" b loop { ${0} } -snippet while "while loop" +snippet wh "while loop" while ${1:condition} { ${0} }