rustic builder method snippets
This commit is contained in:
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user