From 68a652ed2f51d366bb8033497e6dfe545895410e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 23 Jul 2026 08:08:33 +0800 Subject: feat: scaffold crate structure and implement core macros Add the project skeleton, LICENSE files, README, Makefile, doc examples, and the initial implementation of `#[func]`, `invoke!`, and `select!` procedural macros. --- doc/usage/func.rs | 4 ++++ doc/usage/func_async_expand.rs | 3 +++ doc/usage/func_async_expand.rs.lock | 3 +++ doc/usage/func_expand.rs | 3 +++ doc/usage/func_expand.rs.lock | 3 +++ doc/usage/invoke.rs | 10 ++++++++++ doc/usage/invoke_async_expand.rs | 6 ++++++ doc/usage/invoke_async_expand.rs.lock | 6 ++++++ doc/usage/invoke_expand.rs | 6 ++++++ doc/usage/invoke_expand.rs.lock | 6 ++++++ doc/usage/select.rs | 3 +++ doc/usage/select_async_expand.rs | 5 +++++ doc/usage/select_async_expand.rs.lock | 5 +++++ doc/usage/select_expand.rs | 5 +++++ doc/usage/select_expand.rs.lock | 5 +++++ 15 files changed, 73 insertions(+) create mode 100644 doc/usage/func.rs create mode 100644 doc/usage/func_async_expand.rs create mode 100644 doc/usage/func_async_expand.rs.lock create mode 100644 doc/usage/func_expand.rs create mode 100644 doc/usage/func_expand.rs.lock create mode 100644 doc/usage/invoke.rs create mode 100644 doc/usage/invoke_async_expand.rs create mode 100644 doc/usage/invoke_async_expand.rs.lock create mode 100644 doc/usage/invoke_expand.rs create mode 100644 doc/usage/invoke_expand.rs.lock create mode 100644 doc/usage/select.rs create mode 100644 doc/usage/select_async_expand.rs create mode 100644 doc/usage/select_async_expand.rs.lock create mode 100644 doc/usage/select_expand.rs create mode 100644 doc/usage/select_expand.rs.lock (limited to 'doc/usage') diff --git a/doc/usage/func.rs b/doc/usage/func.rs new file mode 100644 index 0000000..f407019 --- /dev/null +++ b/doc/usage/func.rs @@ -0,0 +1,4 @@ +#[func] +pub fn greet(name: &str) -> String { + "Hello, {name}!".to_string() +} diff --git a/doc/usage/func_async_expand.rs b/doc/usage/func_async_expand.rs new file mode 100644 index 0000000..ac52411 --- /dev/null +++ b/doc/usage/func_async_expand.rs @@ -0,0 +1,3 @@ +pub async fn greet(name: &str) -> String { + "Hello, {name}!".to_string() +} diff --git a/doc/usage/func_async_expand.rs.lock b/doc/usage/func_async_expand.rs.lock new file mode 100644 index 0000000..ac52411 --- /dev/null +++ b/doc/usage/func_async_expand.rs.lock @@ -0,0 +1,3 @@ +pub async fn greet(name: &str) -> String { + "Hello, {name}!".to_string() +} diff --git a/doc/usage/func_expand.rs b/doc/usage/func_expand.rs new file mode 100644 index 0000000..70dee21 --- /dev/null +++ b/doc/usage/func_expand.rs @@ -0,0 +1,3 @@ +pub fn greet(name: &str) -> String { + "Hello, {name}!".to_string() +} diff --git a/doc/usage/func_expand.rs.lock b/doc/usage/func_expand.rs.lock new file mode 100644 index 0000000..70dee21 --- /dev/null +++ b/doc/usage/func_expand.rs.lock @@ -0,0 +1,3 @@ +pub fn greet(name: &str) -> String { + "Hello, {name}!".to_string() +} diff --git a/doc/usage/invoke.rs b/doc/usage/invoke.rs new file mode 100644 index 0000000..0ae90d2 --- /dev/null +++ b/doc/usage/invoke.rs @@ -0,0 +1,10 @@ +#[func] +fn compute(x: i32) -> i32 { + x * 2 +} + +#[func] +fn example() -> i32 { + // invoke! macro should be used with #[func] + invoke!(compute(5)) +} diff --git a/doc/usage/invoke_async_expand.rs b/doc/usage/invoke_async_expand.rs new file mode 100644 index 0000000..4b8d93f --- /dev/null +++ b/doc/usage/invoke_async_expand.rs @@ -0,0 +1,6 @@ +async fn compute(x: i32) -> i32 { + x * 2 +} +async fn example() -> i32 { + { { compute(5).await } } +} diff --git a/doc/usage/invoke_async_expand.rs.lock b/doc/usage/invoke_async_expand.rs.lock new file mode 100644 index 0000000..4b8d93f --- /dev/null +++ b/doc/usage/invoke_async_expand.rs.lock @@ -0,0 +1,6 @@ +async fn compute(x: i32) -> i32 { + x * 2 +} +async fn example() -> i32 { + { { compute(5).await } } +} diff --git a/doc/usage/invoke_expand.rs b/doc/usage/invoke_expand.rs new file mode 100644 index 0000000..3274d77 --- /dev/null +++ b/doc/usage/invoke_expand.rs @@ -0,0 +1,6 @@ +fn compute(x: i32) -> i32 { + x * 2 +} +fn example() -> i32 { + { { compute(5) } } +} diff --git a/doc/usage/invoke_expand.rs.lock b/doc/usage/invoke_expand.rs.lock new file mode 100644 index 0000000..3274d77 --- /dev/null +++ b/doc/usage/invoke_expand.rs.lock @@ -0,0 +1,6 @@ +fn compute(x: i32) -> i32 { + x * 2 +} +fn example() -> i32 { + { { compute(5) } } +} diff --git a/doc/usage/select.rs b/doc/usage/select.rs new file mode 100644 index 0000000..8cffcf8 --- /dev/null +++ b/doc/usage/select.rs @@ -0,0 +1,3 @@ +fn example() { + select! [{ 100 } else { 200 }]; +} diff --git a/doc/usage/select_async_expand.rs b/doc/usage/select_async_expand.rs new file mode 100644 index 0000000..b2553f3 --- /dev/null +++ b/doc/usage/select_async_expand.rs @@ -0,0 +1,5 @@ +fn example() { + { + { { 100 } } + }; +} diff --git a/doc/usage/select_async_expand.rs.lock b/doc/usage/select_async_expand.rs.lock new file mode 100644 index 0000000..b2553f3 --- /dev/null +++ b/doc/usage/select_async_expand.rs.lock @@ -0,0 +1,5 @@ +fn example() { + { + { { 100 } } + }; +} diff --git a/doc/usage/select_expand.rs b/doc/usage/select_expand.rs new file mode 100644 index 0000000..8caed8e --- /dev/null +++ b/doc/usage/select_expand.rs @@ -0,0 +1,5 @@ +fn example() { + { + { { 200 } } + }; +} diff --git a/doc/usage/select_expand.rs.lock b/doc/usage/select_expand.rs.lock new file mode 100644 index 0000000..8caed8e --- /dev/null +++ b/doc/usage/select_expand.rs.lock @@ -0,0 +1,5 @@ +fn example() { + { + { { 200 } } + }; +} -- cgit