call2-for-syn

Lib.rs Crates.io Docs.rs

Rust 1.40.0 Build Status Crates.io - License

GitHub open issues open pull requests crev reviews

This library provides a call2 function that sits somewhere in-between syn's parse2 and ParseBuffer::call: It lets you conveniently apply a parser function to a proc-macro2 token stream, for example from a quote!.

Installation

Please use cargo-edit to always add the latest version of this library:

cmd cargo add call2-for-syn

Example

```rust use { call2forsyn::call2, quote::quote, syn::{Ident, Token}, };

let (hello, world) = call2::, _>( quote!(Hello world!), |input| { let hello: Ident = input.parse()?; let world: Ident = input.parse()?; input.parse::

asserteq!(format!("{}", hello), "Hello"); asserteq!(format!("{}", world), "world"); ```

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Changelog

Versioning

call2-for-syn strictly follows Semantic Versioning 2.0.0 with the following exceptions:

This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.

Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.