Skip to main content

Crate goish_macros

Crate goish_macros 

Source
Expand description

goish-macros: internal proc-macro support for the main goish crate.

Exposes rewrite_go_body! — parses a goroutine body, walks the AST, and rewrites goish’s sync API calls into their async equivalents:

.Send(x) → .send(x).await .Recv() → .recv().await .Wait() → .wait().await

This is what lets a go!{ c.Send(v); let (x, _) = d.Recv(); } call site read identically to a non-goroutine caller. The rewrite is purely syntactic — there’s no type information — so any user method named Send/Recv/Wait inside a go!{} body will also be rewritten. Collateral damage is the cost of transparent async.

Macros§

rewrite_go_body
rewrite_go_body!(stmts...) — used by goish::go!{} macro_rules to preprocess the user’s body. Accepts raw statements, walks them, emits the rewritten tokens.
select