Derive all struct and enum with debug

This commit is contained in:
Mylloon 2023-05-02 13:34:43 +02:00
parent 36d4889983
commit 76c682264f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
9 changed files with 23 additions and 22 deletions

View file

@ -7,7 +7,7 @@ use std::{fs::File, io::Write, path::Path};
use crate::template::Template;
/// Store the configuration of config/config.toml
#[derive(Deserialize, Clone, Default)]
#[derive(Deserialize, Clone, Default, Debug)]
pub struct FileConfig {
/// http/https
pub scheme: Option<String>,
@ -66,7 +66,7 @@ impl FileConfig {
}
/// Configuration used internally in the app
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Config {
/// Information given in the config file
pub fc: FileConfig,

View file

@ -2,7 +2,7 @@ use chrono::{Datelike, NaiveDate};
use ramhorns::Content;
use serde::{Deserialize, Deserializer};
#[derive(Content, Default)]
#[derive(Content, Default, Debug)]
pub struct Date {
pub day: u32,
pub month: u32,

View file

@ -5,12 +5,12 @@ use serde::Deserialize;
use crate::misc::utils::get_reqwest_client;
#[derive(Deserialize)]
#[derive(Deserialize, Debug)]
struct GithubResponse {
items: Vec<GithubProject>,
}
#[derive(Deserialize)]
#[derive(Deserialize, Debug)]
struct GithubProject {
repository_url: String,
number: u32,
@ -19,13 +19,13 @@ struct GithubProject {
pull_request: GithubPullRequest,
}
#[derive(Deserialize)]
#[derive(Deserialize, Debug)]
struct GithubPullRequest {
html_url: String,
merged_at: Option<String>,
}
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Debug)]
pub enum ProjectState {
Closed = 0,
Open = 1,
@ -43,6 +43,7 @@ impl From<u8> for ProjectState {
}
}
#[derive(Debug)]
pub struct Project {
pub project: String,
pub project_url: String,

View file

@ -8,7 +8,7 @@ use ramhorns::Content;
use serde::Deserialize;
use std::fs;
#[derive(Default, Deserialize, Content)]
#[derive(Default, Deserialize, Content, Debug)]
pub struct FileMetadata {
pub title: Option<String>,
pub link: Option<String>,
@ -17,7 +17,7 @@ pub struct FileMetadata {
pub publish: Option<bool>,
}
#[derive(Content)]
#[derive(Content, Debug)]
pub struct Metadata {
pub info: FileMetadata,
pub math: bool,
@ -25,7 +25,7 @@ pub struct Metadata {
pub syntax_highlight: bool,
}
#[derive(Content)]
#[derive(Content, Debug)]
pub struct File {
pub metadata: Metadata,
pub content: String,

View file

@ -13,7 +13,7 @@ pub async fn security(req: HttpRequest, config: web::Data<Config>) -> impl Respo
))
}
#[derive(Content)]
#[derive(Content, Debug)]
struct SecurityTemplate {
contact: String,
pref_lang: String,
@ -38,7 +38,7 @@ pub async fn humans(config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_humanstxt(config.get_ref().to_owned()))
}
#[derive(Content)]
#[derive(Content, Debug)]
struct HumansTemplate {
contact: String,
lang: String,

View file

@ -34,7 +34,7 @@ pub async fn index(req: HttpRequest, config: web::Data<Config>) -> impl Responde
))
}
#[derive(Content)]
#[derive(Content, Debug)]
struct BlogIndexTemplate {
posts: Vec<Post>,
no_posts: bool,
@ -66,7 +66,7 @@ pub fn build_index(config: Config, url: String) -> String {
)
}
#[derive(Content)]
#[derive(Content, Debug)]
struct Post {
title: String,
date: Date,
@ -162,7 +162,7 @@ fn get_posts(location: &str) -> Vec<Post> {
.collect::<Vec<Post>>()
}
#[derive(Content)]
#[derive(Content, Debug)]
struct BlogPostTemplate {
post: Option<File>,
}

View file

@ -18,7 +18,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
HttpResponse::Ok().body(build_page(config.get_ref().to_owned(), url).await)
}
#[derive(Content)]
#[derive(Content, Debug)]
struct PortfolioTemplate {
error: bool,
projects: Option<Vec<Project>>,
@ -26,7 +26,7 @@ struct PortfolioTemplate {
closed: Option<Vec<Project>>,
}
#[derive(Content, Clone)]
#[derive(Content, Clone, Debug)]
struct Project {
name: String,
url: String,
@ -35,7 +35,7 @@ struct Project {
pulls_closed: Vec<Pull>,
}
#[derive(Content, Clone)]
#[derive(Content, Clone, Debug)]
struct Pull {
url: String,
id: u32,

View file

@ -20,7 +20,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
))
}
#[derive(Content)]
#[derive(Content, Debug)]
struct PortfolioTemplate<'a> {
bots_app: Option<Vec<File>>,
bots_loc: Option<String>,

View file

@ -1,7 +1,7 @@
use ramhorns::{Content, Ramhorns};
/// Structure used in the config variable of the app
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Template {
/// Root directory where templates are stored
pub directory: String,
@ -10,7 +10,7 @@ pub struct Template {
}
/// Structure used by /routes/*.rs
#[derive(Default)]
#[derive(Default, Debug)]
pub struct Infos {
/// Title
pub page_title: Option<String>,
@ -23,7 +23,7 @@ pub struct Infos {
}
/// Final structure given to template
#[derive(Content)]
#[derive(Content, Debug)]
struct Data<T> {
/// App name
app_name: String,