Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions snippets/rust-mode/display
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions snippets/rust-mode/from
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions snippets/rust-mode/fromstr
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions snippets/rust-mode/result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Result<Type, failure::Error>
# key: result
# --
Result<${1:Type}, ${2:failure::Error}>