Skip to main content

Crate roam_macros_core

Crate roam_macros_core 

Source
Expand description

Code generation core for roam RPC service macros.

This crate contains all the code generation logic for the #[service] proc macro, extracted into a regular library so it can be unit-tested with insta snapshots.

Modules§

crate_name
Crate name detection for proc-macros.

Structs§

AngleTokenTree
Parses either a TokenTree or <...> grouping.
DocAttribute
Error
Error type for validation/codegen errors.
GenericParams
KAsync
Matches: async,
KDoc
Matches: doc,
KFn
Matches: fn,
KMut
Matches: mut,
KPub
Matches: pub,
KSelfKw
Matches: self,
KTrait
Matches: trait,
KWhere
Matches: where,
Lifetime
MethodParam
MethodParams
ParseError
Error type for parsing.
PathWithGenerics
RawAttribute
RefSelf
ReturnType
ServiceMethod
ServiceTrait
TypePath
TypeRef
TypeTuple
WhereClause

Enums§

GenericArgument
Type
Visibility

Traits§

ToTokens
unsynn defines its own ToTokens trait to be able to implement it for std container types. This is similar to the ToTokens from the quote crate but adds some extra methods and is implemented for more types. Moreover the to_token_iter() method is the main entry point for crating an iterator that can be used for parsing.

Functions§

generate_service
Generate all service code for a parsed trait.
method_ok_and_err_types
Extract Ok and Err types from a return type. Returns (ok_type, Some(err_type)) for Result<T, E>, or (type, None) otherwise.
parse
Parse a trait definition from a token stream, returning a codegen-friendly error.
parse_trait
Parse a trait definition from a token stream.
roam_crate
Returns the token stream for accessing the roam crate.