Crate do_with_in

Source
Expand description

Use-site metaprogramming inspired by staging

This crate lets you run code at compile time to produce the tokens other proc_macros will consume. It is also useful for ad-hoc in place code generation, and for making templates (like Jinja or Mustache for your code). It uses its own simple inner language based on handlers, variables, and a user chosen sigil. The stage separation model of Rust does impose some limitations on what this crate can do.

There are two common ways to use this crate. As an end user, it is most likely that you will use the do_with_in proc_macro directly. But if you want to make use of parts of the functionality in order to implement these features into your own proc_macro directly, or to implement your own handlers offering extended functionality in the staged language, you’ll end up (at this stage) using the reexports from do_with_in_base, most notably do_with_in_explicit2.

The base handler list is in genericDefaultHandlers.

Macros§

do_with_in
This is the proc_macro most users of this crate will use.

Structs§

Configuration
DoMarker
Res
Variables

Enums§

Escaping
Sigil

Traits§

StartMarker

Functions§

actually_escape
actually_unescape
arithmeticHandler
Perform basic arithmetic calculations.
arrayHandler
Provides tools for working with arrays.
assignmentInternalHandler
concatHandler
Concatenate two or more values together into a string.
concatHandlerInner
do_with_in_explicit
do_with_in_explicit2
The function used to actually run a stage.
do_with_in_internal
escape
fnHandler
forHandler
genericDefaultHandlers
This function generates the default handler set.
handleMkHandlerRunner
ifHandler
Conditionally execute one of two branches, depending on the result of a test expression.
importHandler
Import the contents of a file.
internalFnRunner
letHandler
Create and assign variables. Does NOT interpolate during either definition or use.
logicHandler
Handle logic expressions with a nestable sublanguage
markerHandler
Embeds data in one invocation of do_with_in! in a way that can be used in other invocations.
mkHandler
naiveStringifierHandler
Return a string representation of a do-with-in! value.
quote
In the lisp sense; renders its argument inert.
run
Evaluate block of code in place.
runMarkersHandler
Loads data into the environment from other invocations of do_with_in!.
string_to_identHandler
Turn a string into a named identifier.
unescape
unquote
In the lisp sense; renders its argument ert.
varHandler
Create and assign variables. DOES interpolate during both definition and use.
withSigilHandler
Redefine which sigil to use within the scope of the handler.

Type Aliases§

Handler
Handlers