♻️ (statics): Renombra StaticResource a StaticFile
Clarifica la distinción entre un fichero estático individual (`StaticFile`) y el contenedor de varios ficheros (`StaticResources`).
This commit is contained in:
parent
b1ce79c78f
commit
2c52af4b9d
6 changed files with 32 additions and 37 deletions
|
|
@ -26,14 +26,11 @@ compilación.
|
|||
|
||||
## Créditos
|
||||
|
||||
Para ello, adapta el código de los *crates* [static-files](https://crates.io/crates/static_files)
|
||||
(versión [0.2.5](https://github.com/static-files-rs/static-files/tree/v0.2.5)) y
|
||||
[actix-web-static-files](https://crates.io/crates/actix_web_static_files) (versión
|
||||
[4.0.1](https://github.com/kilork/actix-web-static-files/tree/v4.0.1)), desarrollados ambos por
|
||||
[Alexander Korolev](https://crates.io/users/kilork).
|
||||
|
||||
Estas implementaciones se integran en PageTop para evitar que cada proyecto tenga que declarar
|
||||
`static-files` manualmente como dependencia en su `Cargo.toml`.
|
||||
Para ello, adapta el código de [static-files](https://crates.io/crates/static_files) (versión
|
||||
[0.2.5](https://github.com/static-files-rs/static-files/tree/v0.2.5)) desarrollado por
|
||||
[Alexander Korolev](https://crates.io/users/kilork), bajo licencia MIT/Apache 2.0. La implementación
|
||||
se integra en PageTop para evitar que cada proyecto tenga que declarar `static-files` manualmente
|
||||
como dependencia en su `Cargo.toml`.
|
||||
*/
|
||||
|
||||
#![doc(test(no_crate_inject))]
|
||||
|
|
@ -44,7 +41,7 @@ Estas implementaciones se integran en PageTop para evitar que cada proyecto teng
|
|||
|
||||
/// Resource definition and single module based generation.
|
||||
pub mod resource;
|
||||
pub use resource::Resource as StaticResource;
|
||||
pub use resource::Resource as StaticFile;
|
||||
|
||||
mod resource_dir;
|
||||
pub use resource_dir::{ResourceDir, resource_dir};
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ pub fn generate_resources<P: AsRef<Path>, G: AsRef<Path>>(
|
|||
/// ```rust
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// use pagetop_statics::StaticResource;
|
||||
/// use pagetop_statics::StaticFile;
|
||||
///
|
||||
/// fn generate_mapping() -> HashMap<&'static str, StaticResource> {
|
||||
/// fn generate_mapping() -> HashMap<&'static str, StaticFile> {
|
||||
/// include!(concat!(env!("OUT_DIR"), "/generated_mapping.rs"))
|
||||
/// }
|
||||
///
|
||||
|
|
@ -221,7 +221,7 @@ pub(crate) fn generate_function_header<F: Write>(
|
|||
) -> io::Result<()> {
|
||||
writeln!(
|
||||
f,
|
||||
"#[allow(clippy::unreadable_literal)] pub fn {fn_name}() -> ::std::collections::HashMap<&'static str, ::{crate_name}::StaticResource> {{",
|
||||
"#[allow(clippy::unreadable_literal)] pub fn {fn_name}() -> ::std::collections::HashMap<&'static str, ::{crate_name}::StaticFile> {{",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ where
|
|||
writeln!(
|
||||
module_file,
|
||||
"
|
||||
use ::{crate_name}::StaticResource;
|
||||
use ::{crate_name}::StaticFile;
|
||||
use ::std::collections::HashMap;"
|
||||
)?;
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ fn create_set_module_file(module_dir: &Path, module_index: usize) -> io::Result<
|
|||
"#[allow(clippy::wildcard_imports)]
|
||||
use super::*;
|
||||
#[allow(clippy::unreadable_literal)]
|
||||
pub(crate) fn generate({DEFAULT_VARIABLE_NAME}: &mut HashMap<&'static str, StaticResource>) {{",
|
||||
pub(crate) fn generate({DEFAULT_VARIABLE_NAME}: &mut HashMap<&'static str, StaticFile>) {{",
|
||||
)?;
|
||||
|
||||
Ok(set_module)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue