commit
1d1ea6f20c
9
snippets/rust-mode/display
Normal file
9
snippets/rust-mode/display
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: impl Display for Type { fn fmt (...) }
|
||||||
|
# key: display
|
||||||
|
# --
|
||||||
|
impl Display for ${1:Type} {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "$0")
|
||||||
|
}
|
||||||
|
}
|
10
snippets/rust-mode/from
Normal file
10
snippets/rust-mode/from
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: impl From<From> for Type { fn from(...) }
|
||||||
|
# key: from
|
||||||
|
# --
|
||||||
|
impl From<${1:From}> for ${2:Type} {
|
||||||
|
fn from(source: $1) -> Self {
|
||||||
|
$0
|
||||||
|
Self { }
|
||||||
|
}
|
||||||
|
}
|
11
snippets/rust-mode/fromstr
Normal file
11
snippets/rust-mode/fromstr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: impl FromStr for Type { fn from_str(...) }
|
||||||
|
# key: fromstr
|
||||||
|
# --
|
||||||
|
impl FromStr for ${1:Type} {
|
||||||
|
type Err = ${2:Error};
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
Ok(Self{})
|
||||||
|
}
|
||||||
|
}
|
5
snippets/rust-mode/result
Normal file
5
snippets/rust-mode/result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Result<Type, failure::Error>
|
||||||
|
# key: result
|
||||||
|
# --
|
||||||
|
Result<${1:Type}, ${2:failure::Error}>
|
Loading…
Reference in a new issue