{"id":13484771,"url":"https://github.com/dtolnay/syn","last_synced_at":"2026-02-15T19:25:02.920Z","repository":{"id":10880715,"uuid":"67305738","full_name":"dtolnay/syn","owner":"dtolnay","description":"Parser for Rust source code","archived":false,"fork":false,"pushed_at":"2026-01-25T02:56:07.000Z","size":11831,"stargazers_count":3274,"open_issues_count":77,"forks_count":358,"subscribers_count":24,"default_branch":"master","last_synced_at":"2026-01-30T11:19:59.639Z","etag":null,"topics":["proc-macro"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtolnay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"dtolnay"}},"created_at":"2016-09-03T18:35:01.000Z","updated_at":"2026-01-29T18:16:09.000Z","dependencies_parsed_at":"2026-01-30T00:01:21.436Z","dependency_job_id":null,"html_url":"https://github.com/dtolnay/syn","commit_stats":{"total_commits":4067,"total_committers":103,"mean_commits":39.48543689320388,"dds":0.08728792721908041,"last_synced_commit":"1f103d4c175ab62b27537a6907c4b77b6aed6ae7"},"previous_names":["dtolnay/item"],"tags_count":357,"template":false,"template_full_name":null,"purl":"pkg:github/dtolnay/syn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fsyn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fsyn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fsyn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fsyn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtolnay","download_url":"https://codeload.github.com/dtolnay/syn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fsyn/sbom","scorecard":{"id":54673,"data":{"date":"2025-08-11","repo":{"name":"github.com/dtolnay/syn","commit":"4476ebf65d7cbe71bba31b9b3c84d87fccc3a513"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.1,"checks":[{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:10","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 15 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:99: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:100: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:178: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:179: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:115: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:116: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:117: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:129: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:130: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:141: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:142: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:153: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:154: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:155: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:165: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:166: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:191: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:192: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:193: update your workflow using https://app.stepsecurity.io/secureworkflow/dtolnay/syn/ci.yml/master?enable=pin","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  14 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: RustCargoFuzzer integration found: fuzz/fuzz_targets/create_token_buffer.rs:3","Info: RustCargoFuzzer integration found: fuzz/fuzz_targets/parse_file.rs:3"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":3,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/dtolnay/.github/SECURITY.md:1","Warn: no linked content found","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy","Info: Found text in security policy: github.com/dtolnay/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T00:26:33.505Z","repository_id":10880715,"created_at":"2025-08-15T00:26:33.505Z","updated_at":"2025-08-15T00:26:33.505Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28923738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T22:32:35.345Z","status":"ssl_error","status_checked_at":"2026-01-30T22:32:31.927Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proc-macro"],"created_at":"2024-07-31T17:01:33.114Z","updated_at":"2026-02-12T06:03:17.146Z","avatar_url":"https://github.com/dtolnay.png","language":"Rust","readme":"Parser for Rust source code\n===========================\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-dtolnay/syn-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/dtolnay/syn)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/syn.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/syn)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-syn-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/syn)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/dtolnay/syn/ci.yml?branch=master\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/dtolnay/syn/actions?query=branch%3Amaster)\n\nSyn is a parsing library for parsing a stream of Rust tokens into a syntax tree\nof Rust source code.\n\nCurrently this library is geared toward use in Rust procedural macros, but\ncontains some APIs that may be useful more generally.\n\n- **Data structures** — Syn provides a complete syntax tree that can represent\n  any valid Rust source code. The syntax tree is rooted at [`syn::File`] which\n  represents a full source file, but there are other entry points that may be\n  useful to procedural macros including [`syn::Item`], [`syn::Expr`] and\n  [`syn::Type`].\n\n- **Derives** — Of particular interest to derive macros is [`syn::DeriveInput`]\n  which is any of the three legal input items to a derive macro. An example\n  below shows using this type in a library that can derive implementations of a\n  user-defined trait.\n\n- **Parsing** — Parsing in Syn is built around [parser functions] with the\n  signature `fn(ParseStream) -\u003e Result\u003cT\u003e`. Every syntax tree node defined by\n  Syn is individually parsable and may be used as a building block for custom\n  syntaxes, or you may dream up your own brand new syntax without involving any\n  of our syntax tree types.\n\n- **Location information** — Every token parsed by Syn is associated with a\n  `Span` that tracks line and column information back to the source of that\n  token. These spans allow a procedural macro to display detailed error messages\n  pointing to all the right places in the user's code. There is an example of\n  this below.\n\n- **Feature flags** — Functionality is aggressively feature gated so your\n  procedural macros enable only what they need, and do not pay in compile time\n  for all the rest.\n\n[`syn::File`]: https://docs.rs/syn/2.0/syn/struct.File.html\n[`syn::Item`]: https://docs.rs/syn/2.0/syn/enum.Item.html\n[`syn::Expr`]: https://docs.rs/syn/2.0/syn/enum.Expr.html\n[`syn::Type`]: https://docs.rs/syn/2.0/syn/enum.Type.html\n[`syn::DeriveInput`]: https://docs.rs/syn/2.0/syn/struct.DeriveInput.html\n[parser functions]: https://docs.rs/syn/2.0/syn/parse/index.html\n\n[*Release notes*](https://github.com/dtolnay/syn/releases)\n\n\u003cbr\u003e\n\n## Resources\n\nThe best way to learn about procedural macros is by writing some. Consider\nworking through [this procedural macro workshop][workshop] to get familiar with\nthe different types of procedural macros. The workshop contains relevant links\ninto the Syn documentation as you work through each project.\n\n[workshop]: https://github.com/dtolnay/proc-macro-workshop\n\n\u003cbr\u003e\n\n## Example of a derive macro\n\nThe canonical derive macro using Syn looks like this. We write an ordinary Rust\nfunction tagged with a `proc_macro_derive` attribute and the name of the trait\nwe are deriving. Any time that derive appears in the user's code, the Rust\ncompiler passes their data structure as tokens into our macro. We get to execute\narbitrary Rust code to figure out what to do with those tokens, then hand some\ntokens back to the compiler to compile into the user's crate.\n\n[`TokenStream`]: https://doc.rust-lang.org/proc_macro/struct.TokenStream.html\n\n```toml\n[dependencies]\nsyn = \"2.0\"\nquote = \"1.0\"\n\n[lib]\nproc-macro = true\n```\n\n```rust\nuse proc_macro::TokenStream;\nuse quote::quote;\nuse syn::{parse_macro_input, DeriveInput};\n\n#[proc_macro_derive(MyMacro)]\npub fn my_macro(input: TokenStream) -\u003e TokenStream {\n    // Parse the input tokens into a syntax tree\n    let input = parse_macro_input!(input as DeriveInput);\n\n    // Build the output, possibly using quasi-quotation\n    let expanded = quote! {\n        // ...\n    };\n\n    // Hand the output tokens back to the compiler\n    TokenStream::from(expanded)\n}\n```\n\nThe [`heapsize`] example directory shows a complete working implementation of a\nderive macro. The example derives a `HeapSize` trait which computes an estimate\nof the amount of heap memory owned by a value.\n\n[`heapsize`]: examples/heapsize\n\n```rust\npub trait HeapSize {\n    /// Total number of bytes of heap memory owned by `self`.\n    fn heap_size_of_children(\u0026self) -\u003e usize;\n}\n```\n\nThe derive macro allows users to write `#[derive(HeapSize)]` on data structures\nin their program.\n\n```rust\n#[derive(HeapSize)]\nstruct Demo\u003c'a, T: ?Sized\u003e {\n    a: Box\u003cT\u003e,\n    b: u8,\n    c: \u0026'a str,\n    d: String,\n}\n```\n\n\u003cbr\u003e\n\n## Spans and error reporting\n\nThe token-based procedural macro API provides great control over where the\ncompiler's error messages are displayed in user code. Consider the error the\nuser sees if one of their field types does not implement `HeapSize`.\n\n```rust\n#[derive(HeapSize)]\nstruct Broken {\n    ok: String,\n    bad: std::thread::Thread,\n}\n```\n\nBy tracking span information all the way through the expansion of a procedural\nmacro as shown in the `heapsize` example, token-based macros in Syn are able to\ntrigger errors that directly pinpoint the source of the problem.\n\n```console\nerror[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied\n --\u003e src/main.rs:7:5\n  |\n7 |     bad: std::thread::Thread,\n  |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HeapSize` is not implemented for `std::thread::Thread`\n```\n\n\u003cbr\u003e\n\n## Parsing a custom syntax\n\nThe [`lazy-static`] example directory shows the implementation of a\n`functionlike!(...)` procedural macro in which the input tokens are parsed using\nSyn's parsing API.\n\n[`lazy-static`]: examples/lazy-static\n\nThe example reimplements the popular `lazy_static` crate from crates.io as a\nprocedural macro.\n\n```rust\nlazy_static! {\n    static ref USERNAME: Regex = Regex::new(\"^[a-z0-9_-]{3,16}$\").unwrap();\n}\n```\n\nThe implementation shows how to trigger custom warnings and error messages on\nthe macro input.\n\n```console\nwarning: come on, pick a more creative name\n  --\u003e src/main.rs:10:16\n   |\n10 |     static ref FOO: String = \"lazy_static\".to_owned();\n   |                ^^^\n```\n\n\u003cbr\u003e\n\n## Testing\n\nWhen testing macros, we often care not just that the macro can be used\nsuccessfully but also that when the macro is provided with invalid input it\nproduces maximally helpful error messages. Consider using the [`trybuild`] crate\nto write tests for errors that are emitted by your macro or errors detected by\nthe Rust compiler in the expanded code following misuse of the macro. Such tests\nhelp avoid regressions from later refactors that mistakenly make an error no\nlonger trigger or be less helpful than it used to be.\n\n[`trybuild`]: https://github.com/dtolnay/trybuild\n\n\u003cbr\u003e\n\n## Debugging\n\nWhen developing a procedural macro it can be helpful to look at what the\ngenerated code looks like. Use `cargo rustc -- -Zunstable-options\n--pretty=expanded` or the [`cargo expand`] subcommand.\n\n[`cargo expand`]: https://github.com/dtolnay/cargo-expand\n\nTo show the expanded code for some crate that uses your procedural macro, run\n`cargo expand` from that crate. To show the expanded code for one of your own\ntest cases, run `cargo expand --test the_test_case` where the last argument is\nthe name of the test file without the `.rs` extension.\n\nThis write-up by Brandon W Maister discusses debugging in more detail:\n[Debugging Rust's new Custom Derive system][debugging].\n\n[debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/\n\n\u003cbr\u003e\n\n## Optional features\n\nSyn puts a lot of functionality behind optional features in order to optimize\ncompile time for the most common use cases. The following features are\navailable.\n\n- **`derive`** *(enabled by default)* — Data structures for representing the\n  possible input to a derive macro, including structs and enums and types.\n- **`full`** — Data structures for representing the syntax tree of all valid\n  Rust source code, including items and expressions.\n- **`parsing`** *(enabled by default)* — Ability to parse input tokens into a\n  syntax tree node of a chosen type.\n- **`printing`** *(enabled by default)* — Ability to print a syntax tree node as\n  tokens of Rust source code.\n- **`visit`** — Trait for traversing a syntax tree.\n- **`visit-mut`** — Trait for traversing and mutating in place a syntax tree.\n- **`fold`** — Trait for transforming an owned syntax tree.\n- **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree\n  types.\n- **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree\n  types.\n- **`proc-macro`** *(enabled by default)* — Runtime dependency on the dynamic\n  library libproc_macro from rustc toolchain.\n\n\u003cbr\u003e\n\n## Proc macro shim\n\nSyn operates on the token representation provided by the [proc-macro2] crate\nfrom crates.io rather than using the compiler's built in proc-macro crate\ndirectly. This enables code using Syn to execute outside of the context of a\nprocedural macro, such as in unit tests or build.rs, and we avoid needing\nincompatible ecosystems for proc macros vs non-macro use cases.\n\nIn general all of your code should be written against proc-macro2 rather than\nproc-macro. The one exception is in the signatures of procedural macro entry\npoints, which are required by the language to use `proc_macro::TokenStream`.\n\nThe proc-macro2 crate will automatically detect and use the compiler's data\nstructures when a procedural macro is active.\n\n[proc-macro2]: https://docs.rs/proc-macro2/1.0/proc_macro2/\n\n\u003cbr\u003e\n\n#### License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","funding_links":["https://github.com/sponsors/dtolnay"],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fsyn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtolnay%2Fsyn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fsyn/lists"}