#macro #join-pattern #join-calculus #macro-derive

macro rusty-junctions-library-generation-proc-macro

The Library Generation component of the rusty-junctions-macro crate

1 unstable release

0.1.0 Mar 24, 2022

#4 in #join-calculus


Used in rusty-junctions-macro

MIT license

32KB
674 lines

Crate providing the essential functionality for the compile time generation of the rusty_junctions crate to an arbitrary pattern arity.

The intention of this crate is to be called from within the root of the rusty_junctions crate library in order to generate all of the essential components:

  • The PartialPattern and TerminalPartialPattern patterns that leverage the compiler to provide the type safety guarantees provided to the clients at compile time, preventing a number of difficult to debug runtime issues.

  • When applying the then_do method to a PartialPattern or a TerminalPartialPattern we are required to pass in a closure. The function_transform are used to transform the types of the closure to accept Message as the arguments.

  • The type of the transformed closures also depend on the arity of the associated pattern, so we are required to generate this programmatically. This is done internally using the function_types Macro.

  • Finally the JoinPattern derive macro which is used to derive the implementation of the JoinPattern trait from the PartialPattern or TerminalPartialPattern.

See the function level documentation for further details.

Dependencies

~1.5MB
~37K SLoC