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§
- Angle
Token Tree - Parses either a
TokenTreeor<...>grouping. - DocAttribute
- Error
- Error type for validation/codegen errors.
- Generic
Params - 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
- Method
Param - Method
Params - Parse
Error - Error type for parsing.
- Path
With Generics - RawAttribute
- RefSelf
- Return
Type - Service
Method - Service
Trait - Type
Path - TypeRef
- Type
Tuple - Where
Clause
Enums§
Traits§
- ToTokens
- unsynn defines its own
ToTokenstrait to be able to implement it for std container types. This is similar to theToTokensfrom the quote crate but adds some extra methods and is implemented for more types. Moreover theto_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
roamcrate.