From eb06c53efcdcac1fc8eeb3eab4450ae26df70c52 Mon Sep 17 00:00:00 2001 From: Ben S Date: Wed, 15 Jul 2015 15:14:26 +0100 Subject: [PATCH] Add a bunch of clippings! --- Contents/Clippings/Rust.rs/Debug println | 1 + Contents/Clippings/Rust.rs/Derive attribute | 1 + Contents/Clippings/Rust.rs/Main function | 3 +++ Contents/Clippings/Rust.rs/Read lines from stdin | 6 ++++++ Contents/Clippings/Rust.rs/Test function | 4 ++++ Contents/Clippings/Rust.rs/Test macro | 8 ++++++++ Contents/Clippings/Rust.rs/Test module | 9 +++++++++ Contents/Clippings/Rust.rs/if let Some() | 3 +++ Contents/Clippings/Rust.rs/match Option | 4 ++++ Contents/Clippings/Rust.rs/match Result | 4 ++++ README.md | 1 + 11 files changed, 44 insertions(+) create mode 100644 Contents/Clippings/Rust.rs/Debug println create mode 100644 Contents/Clippings/Rust.rs/Derive attribute create mode 100644 Contents/Clippings/Rust.rs/Main function create mode 100644 Contents/Clippings/Rust.rs/Read lines from stdin create mode 100644 Contents/Clippings/Rust.rs/Test function create mode 100644 Contents/Clippings/Rust.rs/Test macro create mode 100644 Contents/Clippings/Rust.rs/Test module create mode 100644 Contents/Clippings/Rust.rs/if let Some() create mode 100644 Contents/Clippings/Rust.rs/match Option create mode 100644 Contents/Clippings/Rust.rs/match Result diff --git a/Contents/Clippings/Rust.rs/Debug println b/Contents/Clippings/Rust.rs/Debug println new file mode 100644 index 0000000..1b4824f --- /dev/null +++ b/Contents/Clippings/Rust.rs/Debug println @@ -0,0 +1 @@ +println!("{:?}", #placeholderstart##placeholderend#); \ No newline at end of file diff --git a/Contents/Clippings/Rust.rs/Derive attribute b/Contents/Clippings/Rust.rs/Derive attribute new file mode 100644 index 0000000..1836637 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Derive attribute @@ -0,0 +1 @@ +#[derive(#placeholderstart#...#placeholderend#)] diff --git a/Contents/Clippings/Rust.rs/Main function b/Contents/Clippings/Rust.rs/Main function new file mode 100644 index 0000000..bf93014 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Main function @@ -0,0 +1,3 @@ +#indent#fn main() { + #placeholderstart#...#placeholderend# +} diff --git a/Contents/Clippings/Rust.rs/Read lines from stdin b/Contents/Clippings/Rust.rs/Read lines from stdin new file mode 100644 index 0000000..851a7d7 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Read lines from stdin @@ -0,0 +1,6 @@ +#INDENT#let stdin = io::stdin(); + +for line in stdin.lock().lines() { + let line = line.unwrap(); + #PLACEHOLDERSTART#...#PLACEHOLDEREND# +} \ No newline at end of file diff --git a/Contents/Clippings/Rust.rs/Test function b/Contents/Clippings/Rust.rs/Test function new file mode 100644 index 0000000..8d39371 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Test function @@ -0,0 +1,4 @@ +\#[test] +#indent#fn #placeholderstart#test#placeholderend#() { + #placeholderstart#...#placeholderend# +} diff --git a/Contents/Clippings/Rust.rs/Test macro b/Contents/Clippings/Rust.rs/Test macro new file mode 100644 index 0000000..faca5e7 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Test macro @@ -0,0 +1,8 @@ +#indent#macro_rules! #placeholderstart#name#placeholderend# { + ($name: ident: $input: expr => $result: expr) => { + #[test] + fn $name() { + assert_eq!($input, $result) + } + }; +} \ No newline at end of file diff --git a/Contents/Clippings/Rust.rs/Test module b/Contents/Clippings/Rust.rs/Test module new file mode 100644 index 0000000..38b0466 --- /dev/null +++ b/Contents/Clippings/Rust.rs/Test module @@ -0,0 +1,9 @@ +#indent#\#[cfg(test)] +mod test { + use super::*; + + \#[test] + fn #placeholderstart#test#placeholderend#() { + #placeholderstart#...#placeholderend# + } +} diff --git a/Contents/Clippings/Rust.rs/if let Some() b/Contents/Clippings/Rust.rs/if let Some() new file mode 100644 index 0000000..afe17f7 --- /dev/null +++ b/Contents/Clippings/Rust.rs/if let Some() @@ -0,0 +1,3 @@ +#indent#if let Some(#placeholderstart#variable#placeholderend#) = #placeholderstart#...#placeholderend# { + #placeholderstart#...#placeholderend# +} diff --git a/Contents/Clippings/Rust.rs/match Option b/Contents/Clippings/Rust.rs/match Option new file mode 100644 index 0000000..fbabf53 --- /dev/null +++ b/Contents/Clippings/Rust.rs/match Option @@ -0,0 +1,4 @@ +#indent#match #placeholderstart#...#placeholderend# { + Some(#placeholderstart#...#placeholderend#) => #placeholderstart#...#placeholderend#, + None => #placeholderstart#...#placeholderend#, +} \ No newline at end of file diff --git a/Contents/Clippings/Rust.rs/match Result b/Contents/Clippings/Rust.rs/match Result new file mode 100644 index 0000000..399f21c --- /dev/null +++ b/Contents/Clippings/Rust.rs/match Result @@ -0,0 +1,4 @@ +#indent#match #placeholderstart#...#placeholderend# { + Ok(#placeholderstart#...#placeholderend#) => #placeholderstart#...#placeholderend#, + Err(#placeholderstart#...#placeholderend#) => #placeholderstart#...#placeholderend#, +} \ No newline at end of file diff --git a/README.md b/README.md index 07b5e69..c9d4da5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ This is a BBEdit 11 Package for [Rust](http://www.rust-lang.org). It provides th - Go to named symbol - Indexed function menu - Code folding +- Clippings By default, it highlights anything beginning with a capital letter in a certain colour. To turn this off, just change the Identifier colour to be the same as the default text colour in Preferences.