dtolnay / dtolnay/syn

Parsing an attribute

Open
#883 4 comments 0 reactions 0 assignees View on GitHub
docs
Dominant language
Rust
Stars
3.4k
Forks
374
Avg merge
1d 5h
Merged PRs (30d)
2

Description

The documentation of parsing an attribute feels incomplete, and rather confusing. I specifically want to inject a new attribute constructed with `quote!` into the vector of attributes I have already parsed from the input to the macro.

Attribute's documentation documents how to convert a `ParseStream` to an `Attribute`, and that seems straightforward and makes sense. However, once I click through to `ParseStream` and `ParseBuffer`s documentation, it is very clear that there is no public way to construct this type.

I can't find any documentation how I am supposed to convert from `proc_macro2::TokenStream` to a `ParseStream` in order to apply `.call(Attribute::parse_outer)`.

EDIT: I guess I just have to write my own custom `Parse` type which will contain a `Vec`? This seems very baroque.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.