aboutsummaryrefslogtreecommitdiff
path: root/mingling/src
diff options
context:
space:
mode:
Diffstat (limited to 'mingling/src')
-rw-r--r--mingling/src/lib.rs18
-rw-r--r--mingling/src/res/dirs/current_dir.rs14
-rw-r--r--mingling/src/res/dirs/current_exe.rs12
-rw-r--r--mingling/src/res/dirs/home_dir.rs13
-rw-r--r--mingling/src/res/dirs/temp_dir.rs4
-rw-r--r--mingling/src/setups/dirs.rs5
6 files changed, 41 insertions, 25 deletions
diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs
index b4372dc..0fd4ece 100644
--- a/mingling/src/lib.rs
+++ b/mingling/src/lib.rs
@@ -118,15 +118,15 @@ pub mod macros {
pub use mingling_macros::node;
/// `pack!(StateGreet = String)` - Used to create a wrapper type for use with `Chain` and `Renderer`
pub use mingling_macros::pack;
- /// `pack_structural!(StateGreet = String)` - Like `pack!` but also marks the type for structured output
- #[cfg(feature = "structural_renderer")]
- pub use mingling_macros::pack_structural;
/// `pack_err!(ErrorUnknown)` - Used to create an error struct with automatic `name` field
#[cfg(feature = "extra_macros")]
pub use mingling_macros::pack_err;
/// `pack_err_structural!(ErrorUnknown)` - Like `pack_err!` but also marks the type for structured output
#[cfg(all(feature = "structural_renderer", feature = "extra_macros"))]
pub use mingling_macros::pack_err_structural;
+ /// `pack_structural!(StateGreet = String)` - Like `pack!` but also marks the type for structured output
+ #[cfg(feature = "structural_renderer")]
+ pub use mingling_macros::pack_structural;
#[cfg(feature = "comp")]
#[doc(hidden)]
pub use mingling_macros::program_comp_gen;
@@ -226,15 +226,9 @@ pub mod prelude {
pub use crate::macros::gen_program;
/// Re-export of the `pack` macro for creating wrapper types.
pub use crate::macros::pack;
- /// Like `pack!` but also marks the type for structured output
- #[cfg(feature = "structural_renderer")]
- pub use mingling_macros::pack_structural;
/// Re-export of the `pack_err` macro for creating error types.
#[cfg(feature = "extra_macros")]
pub use crate::macros::pack_err;
- /// Like `pack_err!` but also marks the type for structured output
- #[cfg(all(feature = "structural_renderer", feature = "extra_macros"))]
- pub use mingling_macros::pack_err_structural;
/// Re-export of the `r_print` macro for printing within a renderer context.
pub use crate::macros::r_print;
/// Re-export of the `r_println` macro for printing with a newline within a renderer
@@ -242,6 +236,12 @@ pub mod prelude {
pub use crate::macros::r_println;
/// Re-export of the `renderer` macro for defining renderer functions.
pub use crate::macros::renderer;
+ /// Like `pack_err!` but also marks the type for structured output
+ #[cfg(all(feature = "structural_renderer", feature = "extra_macros"))]
+ pub use mingling_macros::pack_err_structural;
+ /// Like `pack!` but also marks the type for structured output
+ #[cfg(feature = "structural_renderer")]
+ pub use mingling_macros::pack_structural;
/// Re-export of the `completion` macro for generating completion entries.
#[cfg(feature = "comp")]
diff --git a/mingling/src/res/dirs/current_dir.rs b/mingling/src/res/dirs/current_dir.rs
index 1de84e0..54d2b05 100644
--- a/mingling/src/res/dirs/current_dir.rs
+++ b/mingling/src/res/dirs/current_dir.rs
@@ -17,7 +17,7 @@ use std::{
/// a `Result`.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ResCurrentDir {
- cwd: PathBuf
+ cwd: PathBuf,
}
impl ResCurrentDir {
@@ -27,13 +27,17 @@ impl ResCurrentDir {
/// deleted or permissions are insufficient). Unlike the `Default` implementation, this
/// method does not panic on failure.
pub fn new() -> Result<Self, std::io::Error> {
- Ok(Self { cwd: current_dir()? })
+ Ok(Self {
+ cwd: current_dir()?,
+ })
}
}
impl Default for ResCurrentDir {
fn default() -> Self {
- Self { cwd: current_dir().unwrap() }
+ Self {
+ cwd: current_dir().unwrap(),
+ }
}
}
@@ -45,7 +49,9 @@ impl From<PathBuf> for ResCurrentDir {
impl From<&Path> for ResCurrentDir {
fn from(path: &Path) -> Self {
- Self { cwd: path.to_path_buf() }
+ Self {
+ cwd: path.to_path_buf(),
+ }
}
}
diff --git a/mingling/src/res/dirs/current_exe.rs b/mingling/src/res/dirs/current_exe.rs
index 051fcee..051f380 100644
--- a/mingling/src/res/dirs/current_exe.rs
+++ b/mingling/src/res/dirs/current_exe.rs
@@ -26,13 +26,17 @@ impl ResCurrentExe {
/// filesystem is not available on Linux, or the process handle is invalid).
/// Unlike the `Default` implementation, this method does not panic on failure.
pub fn new() -> Result<Self, std::io::Error> {
- Ok(Self { exe: current_exe()? })
+ Ok(Self {
+ exe: current_exe()?,
+ })
}
}
impl Default for ResCurrentExe {
fn default() -> Self {
- Self { exe: current_exe().unwrap() }
+ Self {
+ exe: current_exe().unwrap(),
+ }
}
}
@@ -44,7 +48,9 @@ impl From<PathBuf> for ResCurrentExe {
impl From<&Path> for ResCurrentExe {
fn from(path: &Path) -> Self {
- Self { exe: path.to_path_buf() }
+ Self {
+ exe: path.to_path_buf(),
+ }
}
}
diff --git a/mingling/src/res/dirs/home_dir.rs b/mingling/src/res/dirs/home_dir.rs
index de2e5e7..fae3055 100644
--- a/mingling/src/res/dirs/home_dir.rs
+++ b/mingling/src/res/dirs/home_dir.rs
@@ -24,15 +24,18 @@ impl ResHomeDir {
/// Returns `Err` if the home directory cannot be determined (e.g., the `HOME` or
/// `USERPROFILE` environment variable is not set).
pub fn new() -> Result<Self, std::io::Error> {
- let home = home_dir_env()
- .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::NotFound, "home directory not found"))?;
+ let home = home_dir_env().ok_or_else(|| {
+ std::io::Error::new(std::io::ErrorKind::NotFound, "home directory not found")
+ })?;
Ok(Self { home })
}
}
impl Default for ResHomeDir {
fn default() -> Self {
- Self { home: home_dir_env().expect("home directory not found") }
+ Self {
+ home: home_dir_env().expect("home directory not found"),
+ }
}
}
@@ -44,7 +47,9 @@ impl From<PathBuf> for ResHomeDir {
impl From<&Path> for ResHomeDir {
fn from(path: &Path) -> Self {
- Self { home: path.to_path_buf() }
+ Self {
+ home: path.to_path_buf(),
+ }
}
}
diff --git a/mingling/src/res/dirs/temp_dir.rs b/mingling/src/res/dirs/temp_dir.rs
index f4f0dca..343d9c7 100644
--- a/mingling/src/res/dirs/temp_dir.rs
+++ b/mingling/src/res/dirs/temp_dir.rs
@@ -40,7 +40,9 @@ impl From<PathBuf> for ResTempDir {
impl From<&Path> for ResTempDir {
fn from(path: &Path) -> Self {
- Self { tmp: path.to_path_buf() }
+ Self {
+ tmp: path.to_path_buf(),
+ }
}
}
diff --git a/mingling/src/setups/dirs.rs b/mingling/src/setups/dirs.rs
index a7f81fa..1f5e2d2 100644
--- a/mingling/src/setups/dirs.rs
+++ b/mingling/src/setups/dirs.rs
@@ -1,9 +1,6 @@
use std::marker::PhantomData;
-use mingling_core::{
- ProgramCollect,
- setup::ProgramSetup,
-};
+use mingling_core::{ProgramCollect, setup::ProgramSetup};
use crate::res::{ResCurrentDir, ResCurrentExe, ResHomeDir, ResTempDir};