rusty-snippy
A simple set of snippets for the Rust programming language.
Basic Snippets
shortcut |
equivalent |
im |
impl |
el |
else |
en |
enum |
fo |
for |
fn |
fn |
if |
if |
le |
let |
ma |
match |
mo |
mod |
st |
struct |
tr |
trait |
ty |
type |
us |
use |
3char Snippets
shortcut |
equivalent |
eni |
enum with impl |
eng |
generic enum |
enig |
generic enum with impl |
ife |
if with else |
ifl |
if let |
ifle |
if let x = y {...} else {...} |
imf |
impl T for Q |
img |
generic impl |
lem |
let mut |
ler |
let ref |
lerm |
let ref mut |
mob |
mod name {...} (b for brackets) |
sti |
struct with impl |
stg |
generic struct |
stig |
generic struct with impl |
trg |
generic trait |
tyg |
generic type |
usa |
use as |
usb |
use module::{...} (b for brackets) |
us* |
use module::* |
Helper Snippets
shortcut |
equivalent |
f- |
fn name() -> {...} |
f= |
() => {...} |
ec |
extern crate |
eca |
extern crate as |
opt |
Option<...> |
res |
Result<...> |
from |
impl From<...> for ... |
| |
multiline lambda |
main |
main function def |
new |
new constructor def |
at |
#[...(...)] attributes |
al |
#[allow($1)] |
dc |
#![allow(dead_code)] |
unu |
#![allow(unused_variables)] |
cfg |
#[cfg(...)] |
cff |
#[cfg(feature="...")] |
drv |
#[derive(...))] |
drv* |
derive common attrs |
ass |
assert!(...) (pardon my french) |
asse |
assert_eq!(...) |
mr |
macro_rules! |
pdb |
println!("... = {:?}", ...); (print debug) |
pln |
println!(...); |
un |
unimplemented!() // TODO |
unr |
unreachable!(...) |
vec |
vec![...] |
test |
#[test] with function def |
testm |
#[cfg(test)] with module def |
todo |
// TODO: ... |
Contribution
Submit an issue or a pull request.
Thanks
This is a fork from trusty_rusty_snippets, I just added my personal snippets here.
| |