cargo fmt
Diff
src/io.rs | 9 ++++++---
src/main.rs | 9 ++++++++-
2 files changed, 10 insertions(+), 8 deletions(-)
@@ -60,16 +60,15 @@
pub async fn store_paste(id: String, content: String) {
purge_old().await;
ENTRIES
.write()
.await
.insert(id, content);
ENTRIES.write().await.insert(id, content);
}
pub async fn get_paste(id: &str) -> Option<RwLockReadGuardRef<'_, LinkedHashMap<String, String>, String>> {
pub async fn get_paste(
id: &str,
) -> Option<RwLockReadGuardRef<'_, LinkedHashMap<String, String>, String>> {
let or = RwLockReadGuardRef::new(Box::new(ENTRIES.read().await));
@@ -64,8 +64,11 @@
#[put("/", data = "<input>")]
async fn submit_raw(input: Data, host: HostHeader<'_>) -> Result<String, Status> {
let mut data = String::new();
input.open().take(1024 * 1000)
.read_to_string(&mut data).await
input
.open()
.take(1024 * 1000)
.read_to_string(&mut data)
.await
.map_err(|_| Status::InternalServerError)?;
let id = generate_id();
@@ -108,7 +111,7 @@
None => String::from(RawStr::from_str(entry).html_escape()),
};
let html = format!(
"<code>{}</code>",
code_highlighted.replace("\n", "\n</code><code>")