🎨 Ejecuta cargo fmt

This commit is contained in:
Manuel Cillero 2022-10-21 20:52:44 +02:00
parent 33415a14bb
commit 3f735f7f56
4 changed files with 7 additions and 12 deletions

View file

@ -55,8 +55,7 @@ impl Application {
})
.bind(format!(
"{}:{}",
&SETTINGS.webserver.bind_address,
&SETTINGS.webserver.bind_port
&SETTINGS.webserver.bind_address, &SETTINGS.webserver.bind_port
))?
.run();

View file

@ -39,8 +39,7 @@ pub static DBCONN: LazyStatic<DbConn> = LazyStatic::new(|| {
"sqlite" => DbUri::parse(
format!(
"{}://{}",
&SETTINGS.database.db_type,
&SETTINGS.database.db_name
&SETTINGS.database.db_type, &SETTINGS.database.db_name
)
.as_str(),
)

View file

@ -136,9 +136,9 @@ use crate::LazyStatic;
use crate::config::data::ConfigData;
use crate::config::file::File;
use std::collections::HashMap;
use std::env;
use std::fmt::Debug;
use std::collections::HashMap;
use serde::Deserialize;
@ -181,15 +181,12 @@ static CONFIG_DATA: LazyStatic<ConfigData> = LazyStatic::new(|| {
// Primero añade la configuración común a todos los entornos. Opcional.
.merge(File::with_name(&format!("{}/{}.toml", CONFIG_DIR, "common")).required(false))
.unwrap()
// Combina la configuración específica del entorno. Por defecto 'default.toml'. Opcional.
.merge(File::with_name(&format!("{}/{}.toml", CONFIG_DIR, run_mode)).required(false))
.unwrap()
// Combina la configuración local. Este archivo no debería incluirse en git. Opcional.
.merge(File::with_name(&format!("{}/{}.toml", CONFIG_DIR, "local")).required(false))
.unwrap()
// Salvaguarda el modo de ejecución.
.set("app.run_mode", run_mode)
.unwrap();
@ -202,7 +199,8 @@ static CONFIG_DATA: LazyStatic<ConfigData> = LazyStatic::new(|| {
///
/// Ver [`Cómo añadir ajustes de configuración`](index.html#cómo-añadir-ajustes-de-configuración).
pub fn init_settings<T>(values: PredefinedSettings) -> T
where T: Deserialize<'static>
where
T: Deserialize<'static>,
{
let mut settings = CONFIG_DATA.clone();
for (key, value) in values.iter() {
@ -280,7 +278,7 @@ pub struct Webserver {
/// Sección *\[dev\]* de la configuración global.
pub struct Dev {
/// Valor predefinido: *""*
pub static_files : String,
pub static_files: String,
}
#[derive(Debug, Deserialize)]

View file

@ -1,12 +1,11 @@
use std::error::Error;
use std::env;
use std::error::Error;
use std::fmt::Debug;
use std::fs;
use std::io::{self, Read};
use std::iter::Iterator;
use std::path::{Path, PathBuf};
/// Describes where the file is sourced.
pub trait FileSource: Debug + Clone {
fn resolve(&self) -> Result<(Option<String>, String), Box<dyn Error + Send + Sync>>;