Made some formatting changes.

This commit is contained in:
2025-11-08 00:04:57 -06:00
parent 49a5cd643d
commit 8b3946458e
5 changed files with 80 additions and 14 deletions

21
.editorconfig Normal file
View File

@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
[*.rs]
max_line_length = 100
[*.md]
# double whitespace at end of line
# denotes a line break in Markdown
trim_trailing_whitespace = false
[*.yml]
indent_size = 2
[Makefile]
indent_style = tab

7
rustfmt.toml Normal file
View File

@@ -0,0 +1,7 @@
edition = "2024"
style_edition = "2024"
comment_width = 100
format_code_in_doc_comments = true
imports_granularity = "Crate"
imports_layout = "Vertical"
wrap_comments = true

View File

@@ -1,7 +1,10 @@
// Just a way to unify error handling. Can translate eyre Reports into // Just a way to unify error handling. Can translate eyre Reports into
// axum responses. // axum responses.
use axum::{http::StatusCode, response::IntoResponse}; use axum::{
http::StatusCode,
response::IntoResponse,
};
use color_eyre::eyre::Report; use color_eyre::eyre::Report;
use std::fmt::Display; use std::fmt::Display;

View File

@@ -1,23 +1,50 @@
// TODO: Add general description of the workings. // TODO: Add general description of the workings.
// TODO: Add ability to run a temporary pastebin // TODO: Add ability to run a temporary pastebin
use crate::error::GBError;
use axum::{ use axum::{
BoxError, Router, BoxError,
Router,
error_handling::HandleErrorLayer, error_handling::HandleErrorLayer,
extract::{DefaultBodyLimit, Multipart, Path, State}, extract::{
DefaultBodyLimit,
Multipart,
Path,
State,
},
http::StatusCode, http::StatusCode,
response::{Html, IntoResponse, Response}, response::{
routing::{get, post}, Html,
IntoResponse,
Response,
},
routing::{
get,
post,
},
}; };
use clap::Parser; use clap::Parser;
use crate::error::GBError;
use nanoid::nanoid; use nanoid::nanoid;
use std::{path::PathBuf, time::Duration}; use std::{
path::PathBuf,
time::Duration,
};
use store::Store; use store::Store;
use tokio::fs; use tokio::fs;
use tower::{ServiceBuilder, buffer::BufferLayer, limit::rate::RateLimitLayer}; use tower::{
use tower_http::{compression::CompressionLayer, limit::RequestBodyLimitLayer, trace::TraceLayer}; ServiceBuilder,
use tracing::{Level, event}; buffer::BufferLayer,
limit::rate::RateLimitLayer,
};
use tower_http::{
compression::CompressionLayer,
limit::RequestBodyLimitLayer,
trace::TraceLayer,
};
use tracing::{
Level,
event,
};
mod error; mod error;
mod store; mod store;
@@ -107,8 +134,11 @@ async fn paste_request(State(state): State<Store>, Path(paste_id): Path<String>)
// RUST_LOG environment variable. // RUST_LOG environment variable.
fn install_tracing() { fn install_tracing() {
use tracing_error::ErrorLayer; use tracing_error::ErrorLayer;
use tracing_subscriber::prelude::*; use tracing_subscriber::{
use tracing_subscriber::{EnvFilter, fmt}; EnvFilter,
fmt,
prelude::*,
};
let fmt_layer = fmt::layer().with_target(false); let fmt_layer = fmt::layer().with_target(false);
let filter_layer = EnvFilter::try_from_default_env() let filter_layer = EnvFilter::try_from_default_env()

View File

@@ -1,7 +1,12 @@
use color_eyre::Result; use color_eyre::Result;
use rocksdb::DB; use rocksdb::DB;
use std::path::{Path, PathBuf}; use std::{
use std::sync::Arc; path::{
Path,
PathBuf,
},
sync::Arc,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Store { pub struct Store {