• Home
  • Raw
  • Download

Lines Matching +full:all +full:- +full:impls

1 …hub]](https://github.com/dtolnay/syn) [![crates-io]](https://crates.io/crates/syn) [![do…
3 //! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo…
4 //! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=55555…
5 //! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&lo…
15 //! - **Data structures** — Syn provides a complete syntax tree that can
21 //! - **Derives** — Of particular interest to derive macros is
24 //! derive implementations of a user-defined trait.
26 //! - **Parsing** — Parsing in Syn is built around [parser functions] with the
27 //! signature `fn(ParseStream) -> Result<T>`. Every syntax tree node defined
32 //! - **Location information** — Every token parsed by Syn is associated with a
35 //! messages pointing to all the right places in the user's code. There is an
38 //! - **Feature flags** — Functionality is aggressively feature gated so your
40 //! time for all the rest.
69 //! proc-macro = true
82 //! pub fn my_macro(input: TokenStream) -> TokenStream {
86 //! // Build the output, possibly using quasi-quotation
106 //! fn heap_size_of_children(&self) -> usize;
129 //! The token-based procedural macro API provides great control over where the
143 //! By tracking span information all the way through the expansion of a
144 //! procedural macro as shown in the `heapsize` example, token-based macros in
150 //! --> src/main.rs:7:5
160 //! The [`lazy-static`] example directory shows the implementation of a
164 //! [`lazy-static`]: https://github.com/dtolnay/syn/tree/master/examples/lazy-static
175 //! static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap();
184 //! --> src/main.rs:10:16
210 //! generated code looks like. Use `cargo rustc -- -Zunstable-options
211 //! --pretty=expanded` or the [`cargo expand`] subcommand.
213 //! [`cargo expand`]: https://github.com/dtolnay/cargo-expand
217 //! your own test cases, run `cargo expand --test the_test_case` where the last
220 //! This write-up by Brandon W Maister discusses debugging in more detail:
223 //! [debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/
233 //! - **`derive`** *(enabled by default)* — Data structures for representing the
235 //! - **`full`** — Data structures for representing the syntax tree of all valid
237 //! - **`parsing`** *(enabled by default)* — Ability to parse input tokens into
239 //! - **`printing`** *(enabled by default)* — Ability to print a syntax tree
241 //! - **`visit`** — Trait for traversing a syntax tree.
242 //! - **`visit-mut`** — Trait for traversing and mutating in place a syntax
244 //! - **`fold`** — Trait for transforming an owned syntax tree.
245 //! - **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree
247 //! - **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree
249 //! - **`proc-macro`** *(enabled by default)* — Runtime dependency on the
273 …clippy::match_wildcard_for_single_variants, // clippy bug: https://github.com/rust-lang/rust-clipp…
293 #[cfg(all(
294 not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
295 feature = "proc-macro"
356 #[cfg(all(any(feature = "full", feature = "derive"), feature = "printing"))]
437 #[cfg(all(any(feature = "full", feature = "derive"), feature = "extra-traits"))]
446 #[cfg(all(
447 not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
449 feature = "proc-macro"
454 #[cfg(all(feature = "parsing", feature = "printing"))]
455 #[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "printing"))))]
458 #[cfg(all(feature = "parsing", feature = "full"))]
624 /// *This module is available only if Syn is built with the `"visit-mut"`
637 /// // syn = { version = "1.0", features = ["full", "visit-mut"] }
675 #[cfg(feature = "visit-mut")]
676 #[cfg_attr(doc_cfg, doc(cfg(feature = "visit-mut")))]
695 /// fn fold_expr_binary(&mut self, node: ExprBinary) -> ExprBinary {
700 /// # fn fold_attribute(&mut self, node: Attribute) -> Attribute;
701 /// # fn fold_expr(&mut self, node: Expr) -> Expr;
702 /// # fn fold_bin_op(&mut self, node: BinOp) -> BinOp;
705 /// pub fn fold_expr_binary<V>(v: &mut V, node: ExprBinary) -> ExprBinary
744 /// fn fold_expr(&mut self, expr: Expr) -> Expr {
767 #[cfg(feature = "clone-impls")]
771 #[cfg(feature = "extra-traits")]
775 #[cfg(feature = "extra-traits")]
779 #[cfg(feature = "extra-traits")]
810 #[cfg(all(any(feature = "full", feature = "derive"), feature = "parsing"))]
813 #[cfg(all(any(feature = "full", feature = "derive"), feature = "printing"))]
835 /// `"proc-macro"` features.*
849 /// pub fn my_macro(input: TokenStream) -> TokenStream {
853 /// // Build the output, possibly using quasi-quotation
862 #[cfg(all(
863 not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
865 feature = "proc-macro"
867 #[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "proc-macro"))))]
868 pub fn parse<T: parse::Parse>(tokens: proc_macro::TokenStream) -> Result<T> { in parse()
872 /// Parse a proc-macro2 token stream into the chosen syntax tree node.
888 pub fn parse2<T: parse::Parse>(tokens: proc_macro2::TokenStream) -> Result<T> { in parse2()
906 /// fn run() -> Result<()> {
917 pub fn parse_str<T: parse::Parse>(s: &str) -> Result<T> { in parse_str()
927 /// - It discards a leading byte order mark `\u{FEFF}` if the file has one.
928 /// - It preserves the shebang line of the file, such as `#!/usr/bin/env rustx`.
942 /// fn run() -> Result<(), Box<Error>> {
958 #[cfg(all(feature = "parsing", feature = "full"))]
959 #[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "full"))))]
960 pub fn parse_file(mut content: &str) -> Result<File> { in parse_file()