Add more comments
Diff
src/highlight.rs | 2 ++
src/io.rs | 8 ++++++++
src/main.rs | 13 +++++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
@@ -7,6 +7,8 @@
pub fn highlight(content: &str, ext: &str) -> Option<String> {
lazy_static! {
static ref SS: SyntaxSet = SyntaxSet::load_defaults_newlines();
@@ -13,6 +13,8 @@
fn purge_old() {
let entries_len = ENTRIES.read().unwrap().len();
let buffer_size = env::var("BIN_BUFFER_SIZE").map(|f| f.parse::<usize>().unwrap()).unwrap_or(1000usize);
@@ -29,6 +31,8 @@
}
pub fn store_paste(content: String) -> String {
thread_local!(static KEYGEN: RefCell<gpw::PasswordGenerator> = RefCell::new(gpw::PasswordGenerator::default()));
let id = KEYGEN.with(|k| k.borrow_mut().next().unwrap());
@@ -39,7 +43,9 @@
id
}
pub fn get_paste(id: &str) -> Option<String> {
ENTRIES.read().unwrap().get(id).cloned()
}
@@ -1,5 +1,4 @@
#![feature(proc_macro_hygiene, decl_macro)]
#![feature(uniform_paths)]
#![feature(type_alias_enum_variants)]
#[macro_use] extern crate lazy_static;
@@ -28,6 +27,10 @@
use std::io::Read;
#[derive(Template)]
#[template(path = "index.html")]
struct Index {}
@@ -38,6 +41,10 @@
}
#[derive(FromForm)]
struct IndexForm {
val: String
@@ -61,7 +68,11 @@
None => Ok(paste)
}
}
#[derive(Template)]
#[template(path = "paste.html")]