From 550476876af4cb9d774daf4d93c33f49afaff10f Mon Sep 17 00:00:00 2001 From: Willem Van den Ende Date: Wed, 10 Aug 2022 22:36:32 +0200 Subject: [PATCH] rustic builder method snippets --- snippets/rustic-mode/builder method | 11 +++++++++++ snippets/rustic-mode/builder method with T Clonable | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 snippets/rustic-mode/builder method create mode 100644 snippets/rustic-mode/builder method with T Clonable diff --git a/snippets/rustic-mode/builder method b/snippets/rustic-mode/builder method new file mode 100644 index 0000000..e2eb829 --- /dev/null +++ b/snippets/rustic-mode/builder method @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: builder method +# key: with_attribute_build +# -- + + pub(crate) fn with_${1:attributename}(&mut self, $1: &str) -> &${2:structname} { + self.$1 = $1.to_string(); + return self; + } + +$0 \ No newline at end of file diff --git a/snippets/rustic-mode/builder method with T Clonable b/snippets/rustic-mode/builder method with T Clonable new file mode 100644 index 0000000..926f01a --- /dev/null +++ b/snippets/rustic-mode/builder method with T Clonable @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: builder method with T Clonable +# key: with_attribute_t_clone +# -- + + pub(crate) fn with_${1:attributename}(&mut self, $1: &${2:Type}) -> &${3:structname} { + self.$1 = $1.clone(); + return self; + } + +$0 \ No newline at end of file