Expand description
The implementation behind #[announce] and #[derive(Announce)], as plain
functions, and the helpers for callbacks and checks. Do not depend on this
crate: go through announce, which re-exports
the public API as announce::machinery and announce::helper.
A proc-macro crate cannot export functions, so the code behind the macros
lives here, in an ordinary library. announce-macros is a thin wrapper
around it. The crate name and layout are not a stable interface.
The API of the generation is announce(), derive_announce() and
Options (announce::machinery). See their docs, and
announce::machinery for how a library uses them. helper is what
callbacks and checks use (announce::helper): the parser of the tokens a
trampoline sends, and the macros callback! and transformer!.
Modules§
Macros§
- callback
- Defines a
#[proc_macro]callback that parses itsInputand turnssyn::Errors into compile errors. The body returnssyn::Result<proc_macro2::TokenStream>. - transformer
- Defines a transformer: a
#[proc_macro]that gets the newest entry as anEntry, rewrites it (the body returnssyn::Result<Entry>), and forwards it to the next list element.
Structs§
- Check
- One check or
metaentry of the attribute:pathorpath(args). - Options
- The parsed arguments of
#[announce(..)]or of the#[announce(..)]helper attribute of#[derive(Announce)].
Enums§
- Layout
- How the generated trampoline holds the item (
layout = .., advanced).
Constants§
- SINGLE_
COPY_ THRESHOLD - Tokens (delimiters of a group counted) from which
layout = autoholds the item once (Layout::Single) instead of copying it into each arm (Layout::Direct), counted on the escaped payload plus META.
Functions§
- announce
- Does what
#[announce(attr)]does toitem. - define_
repeater - Does what
define_repeater!($vis $ident)does: the definition of the repeater trait, as type-leak writes it (type_leak::repeater_definition). - derive_
announce - Does what
#[derive(Announce)]does to its input. - derive_
announce_ with - Like
derive_announce(), with the options given in code instead of a helper attribute. Any#[announce(..)]attribute on the input is removed and ignored. - finish
- What the hidden macro
finish!of theannouncecrate does: the end of the attribute query that#[announce(check, ..)]and the derives send through their checks (seecrate::helper::attrsfor the protocol). - try_
announce announce()with the error returned as asyn::Error.- try_
define_ repeater define_repeater()with the error returned as asyn::Error.- try_
derive_ announce derive_announce()with the error returned as asyn::Error.- try_
finish finish()with the error returned as asyn::Error.