From 2caa7e924bade6b88079cdfb1abd4672ba8d72b0 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sat, 27 Jul 2024 13:36:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20[build]=20release=20development?= =?UTF-8?q?=20version=200.0.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers/pagetop-build/Cargo.toml | 4 ++-- helpers/pagetop-build/src/lib.rs | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/helpers/pagetop-build/Cargo.toml b/helpers/pagetop-build/Cargo.toml index 070ae816..a07eaab8 100644 --- a/helpers/pagetop-build/Cargo.toml +++ b/helpers/pagetop-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pagetop-build" -version = "0.0.10" +version = "0.0.11" edition = "2021" description = "Simplifies the process of embedding resources in PageTop app binaries." @@ -19,4 +19,4 @@ keywords = [ ] [dependencies] -static-files = "0.2.3" +static-files = "0.2.4" diff --git a/helpers/pagetop-build/src/lib.rs b/helpers/pagetop-build/src/lib.rs index 8c53d241..a756ea55 100644 --- a/helpers/pagetop-build/src/lib.rs +++ b/helpers/pagetop-build/src/lib.rs @@ -62,7 +62,8 @@ //! static_files!(guides); //! ``` //! -//! Also you can get the bundle as a static reference to the generated HashMap resources collection: +//! Also you can get the bundle as a static reference to the generated `HashMap` resources +//! collection: //! //! ```rust#ignore //! use pagetop::prelude::*; @@ -81,11 +82,16 @@ impl StaticFilesBundle { StaticFilesBundle(static_files::resource_dir(dir)) } + /// Configures the name for the bundle of static files. + /// + /// # Panics + /// + /// This function will panic if the standard `OUT_DIR` environment variable is not set. pub fn with_name(mut self, name: &'static str) -> Self { self.0.with_generated_filename( - Path::new(std::env::var("OUT_DIR").unwrap().as_str()).join(format!("{}.rs", name)), + Path::new(std::env::var("OUT_DIR").unwrap().as_str()).join(format!("{name}.rs")), ); - self.0.with_module_name(format!("bundle_{}", name)); + self.0.with_module_name(format!("bundle_{name}")); self.0.with_generated_fn(name); self } @@ -95,6 +101,12 @@ impl StaticFilesBundle { self } + /// Builds the bundle. + /// + /// # Errors + /// + /// This function will return an error if there is an issue with I/O operations, such as failing + /// to read or write to a file. pub fn build(self) -> std::io::Result<()> { self.0.build() }