Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/copper-proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pistonite-cu-proc-macros"
version = "0.2.9"
version = "0.2.10"
edition = "2024"
description = "Proc-macros for Cu"
repository = "https://github.com/Pistonite/cu"
Expand All @@ -12,7 +12,7 @@ exclude = [

[dependencies.pm]
package = "pistonite-pm"
version = "0.2.7"
version = "0.3.0"
path = "../promethium"
features = ["full"]

Expand Down
30 changes: 15 additions & 15 deletions packages/copper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pistonite-cu"
version = "0.9.2"
version = "0.9.3"
edition = "2024"
description = "Battery-included common utils to speed up development of rust tools"
repository = "https://github.com/Pistonite/cu"
Expand All @@ -11,54 +11,54 @@ exclude = [
]

[dependencies]
pistonite-cu-proc-macros = { version = "0.2.9", path = "../copper-proc-macros" }
pistonite-cu-proc-macros = { version = "0.2.10", path = "../copper-proc-macros" }

# --- Always enabled ---
anyhow = "1.0.103"
log = "0.4.33"
anyhow = "1.0.104"
log = "0.4.34"

# --- Command Line Interface ---
oneshot = { version = "0.2.1", optional = true, features = ["std"] }
env_filter = { version = "2.0.0", optional = true }
terminal_size = { version = "0.4.4", optional = true }
unicode-width = { version = "0.2.2", features = ["cjk"], optional = true }
clap = { version = "4.6.1", features = ["derive"], optional = true }
regex = { version = "1.13.0", optional = true }
clap = { version = "4.6.6", features = ["derive"], optional = true }
regex = { version = "1.13.1", optional = true }
ctrlc = { version = "3.5.2", optional = true }

# --- Coroutine ---
num_cpus = { version = "1.17.0", optional = true }
tokio = { version = "1.52.3", optional = true, features = [
tokio = { version = "1.53.1", optional = true, features = [
"macros", "rt-multi-thread"
] }

# --- File System ---
dunce = {version="1.0.5", optional = true}
which = {version = "8.0.4", optional = true }
which = {version = "8.0.6", optional = true }
pathdiff = {version = "0.2.3", optional=true}
filetime = { version = "0.2.29", optional = true}
ignore = { version = "0.4.28", optional = true }
spin = {version = "0.12.1", optional = true} # for PIO
ignore = { version = "0.4.33", optional = true }
spin = {version = "0.12.3", optional = true} # for PIO

# serde
serde = { version = "1.0.228", features = ["derive"], optional = true }
serde_json = { version = "1.0.150", optional = true }
serde = { version = "1.0.229", features = ["derive"], optional = true }
serde_json = { version = "1.0.151", optional = true }
serde_yaml_ng = { version = "0.10.0", optional = true }
toml = { version = "1.1.2", optional = true }
toml = { version = "1.1.5", optional = true }

# derive
derive_more = { version = "2.1.1", features = ["full"], optional = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2.186"
libc = "0.2.189"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_System_Console", "Win32_Storage_FileSystem", "Win32_Security", "Win32_System_SystemServices"] }

[dev-dependencies]

[dev-dependencies.tokio]
version = "1.52.3"
version = "1.53.1"
features = [ "macros", "rt-multi-thread", "time" ]

[features]
Expand Down
33 changes: 25 additions & 8 deletions packages/copper/src/str/path_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ macro_rules! path {
$crate::__path_internal!(x / $($rest_segs)*)
}};
(( $first:expr ) / $($rest_segs:tt)* ) => {{
let mut x: ::std::path::PathBuf = { $first };
let mut x: ::std::path::PathBuf = $first;
$crate::__path_internal!(x / $($rest_segs)*)
}};
( & ( $first:expr ) / $($rest_segs:tt)* ) => {{
let x: &::std::path::Path = {$first}.as_ref();
let x: &::std::path::Path = ($first).as_ref();
let mut x = x.to_path_buf();
$crate::__path_internal!(x / $($rest_segs)*)
}};
Expand Down Expand Up @@ -174,7 +174,7 @@ macro_rules! __path_internal {
}};
($first:ident / $second:literal / ( $third:expr ) / $($rest_segs:tt)* ) => {{
$first.push($second);
let x: &::std::path::Path = {$third}.as_ref();
let x: &::std::path::Path = ($third).as_ref();
$first.push(x);
$crate::__path_internal!($first / $($rest_segs)* )
}};
Expand All @@ -200,7 +200,7 @@ macro_rules! __path_internal {
($first:ident / $second:ident / ( $third:expr ) / $($rest_segs:tt)* ) => {{
let x: &::std::path::Path = $second.as_ref();
$first.push(x);
let x: &::std::path::Path = {$third}.as_ref();
let x: &::std::path::Path = ($third).as_ref();
$first.push(x);
$crate::__path_internal!($first / $($rest_segs)* )
}};
Expand All @@ -213,7 +213,7 @@ macro_rules! __path_internal {
}};
// expression muchering (1 at a time)
($first:ident / ( $second:expr ) / $($rest_segs:tt)* ) => {{
let x: &::std::path::Path = {$second}.as_ref();
let x: &::std::path::Path = ($second).as_ref();
$first.push(x);
$crate::__path_internal!($first / $($rest_segs)* )
}};
Expand All @@ -228,17 +228,17 @@ macro_rules! __path_internal {

($first:ident / $second:literal / $third:expr) => {{
$first.push($second);
let x: &::std::path::Path = {$third}.as_ref();
let x: &::std::path::Path = ($third).as_ref();
$first.push(x); $first
}};
($first:ident / $second:ident / $third:expr) => {{
let x: &::std::path::Path = $second.as_ref();
$first.push(x);
let x: &::std::path::Path = {$third}.as_ref();
let x: &::std::path::Path = ($third).as_ref();
$first.push(x); $first
}};
($first:ident / $second:expr) => {{
let x: &::std::path::Path = {$second}.as_ref();
let x: &::std::path::Path = ($second).as_ref();
$first.push(x); $first
}};

Expand Down Expand Up @@ -368,4 +368,21 @@ mod tests {
assert_eq!(p, nine_expected());
let _ = (b, e, h);
}

#[test]
fn no_temporary() {
let aaa = String::from("aaa");
let bbb = String::from("bbb");
struct Foo {
bar: String,
}
let foo = Foo {
bar: String::from("bar"),
};
let p = crate::path!(&aaa / "k" / bbb / foo.bar);
let expected = PathBuf::from("aaa").join("k").join("bbb").join("bar");
assert_eq!(p, expected);
let p = crate::path!((aaa.into()) / "k" / bbb / foo.bar);
assert_eq!(p, expected);
}
}
8 changes: 4 additions & 4 deletions packages/promethium/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pistonite-pm"
version = "0.2.7"
version = "0.3.0"
edition = "2024"
description = "Procedural Macro Common Utils"
repository = "https://github.com/Pistonite/cu"
Expand All @@ -11,9 +11,9 @@ exclude = [
]

[dependencies]
proc-macro2 = { version = "1.0.106", default-features = false }
quote = { version = "1.0.46", default-features = false }
syn = { version = "2.0.118", default-features = false }
proc-macro2 = { version = "1.0.107", default-features = false }
quote = { version = "1.0.47", default-features = false }
syn = { version = "3.0.5", default-features = false }

[features]
default = [
Expand Down