import instead of qualify

This commit is contained in:
Mylloon 2023-04-14 11:30:47 +02:00
parent 530975efff
commit 4b5fa8561c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
7 changed files with 9 additions and 7 deletions

View file

@ -1,5 +1,6 @@
use actix_files::Files;
use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
use std::io::Result;
mod config;
mod template;
@ -27,7 +28,7 @@ mod portfolio;
mod contrib;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
async fn main() -> Result<()> {
let config = config::get_config("./config/config.toml");
let addr = ("0.0.0.0", config.fc.port.unwrap());

View file

@ -40,7 +40,7 @@ struct Pull {
}
#[once(time = 120)]
pub async fn get_page(config: Config) -> std::string::String {
pub async fn get_page(config: Config) -> String {
// Fetch latest data from github
let data = match fetch_pr().await {
Ok(projects) => {

View file

@ -13,7 +13,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
struct IndexTemplate {}
#[once(time = 60)]
pub fn get_page(config: Config) -> std::string::String {
pub fn get_page(config: Config) -> String {
config.tmpl.render(
"index.html",
IndexTemplate {},

View file

@ -13,7 +13,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
struct NetworksTemplate {}
#[once(time = 60)]
pub fn get_page(config: Config) -> std::string::String {
pub fn get_page(config: Config) -> String {
config.tmpl.render(
"networks.html",
NetworksTemplate {},

View file

@ -12,7 +12,7 @@ pub async fn page(config: web::Data<Config>) -> impl Responder {
struct Error404Template {}
#[once(time = 60)]
pub fn get_page(config: Config) -> std::string::String {
pub fn get_page(config: Config) -> String {
config
.tmpl
.render("404.html", Error404Template {}, Infos::default())

View file

@ -21,7 +21,7 @@ struct PortfolioTemplate {
}
#[once(time = 60)]
pub fn get_page(config: Config) -> std::string::String {
pub fn get_page(config: Config) -> String {
let projects_dir = "data/projects";
let ext = ".md";

View file

@ -1,5 +1,6 @@
use ramhorns::{Content, Ramhorns};
use serde::Deserialize;
use std::fs;
#[derive(Clone)]
pub struct Template {
@ -72,7 +73,7 @@ pub struct File {
pub fn read_md(filename: &str) -> File {
// Read markdown file
let mut text = std::fs::read_to_string(filename).unwrap();
let mut text = fs::read_to_string(filename).unwrap();
// Transform LaTeX to MathML
text = latex2mathml::replace(&text).unwrap();