[][src]Crate syn_mid

Providing the features between "full" and "derive" of syn.

This crate provides the following two unique data structures.

  • syn_mid::ItemFn -- A function whose body is not parsed.

    fn process(n: usize) -> Result<()> { ... }
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^     ^
    
  • syn_mid::Block -- A block whose body is not parsed.

    { ... }
    ^     ^
    

Other data structures are the same as data structures of syn. Also, if the "full" feature is enabled, those items are reexported from syn.

Note that if you use syn with "full" feature and use syn-mid without "full" feature at the same time, errors due to type mismatch may occur.

Optional features

syn-mid in the default features aims to provide the features between "full" and "derive" of syn.

  • derive (enabled by default) — Data structures for representing the possible input to a custom derive, including structs and enums and types.
  • full — Data structures for representing the syntax tree of all valid Rust source code, including items and expressions.
  • clone-impls (enabled by default) — Clone impls for all syntax tree types.
  • extra-traits — Debug, Eq, PartialEq, Hash impls for all syntax tree types.

Note that if both "derive" and "full" features are disabled, a compile error occurs.

Structs

ArgCaptured

An explicitly typed pattern captured by a function signature.

ArgSelf

Self captured by value in a function signature: self or mut self.

ArgSelfRef

Self captured by reference in a function signature: &self or &mut self.

Block

A braced block containing Rust statements.

FieldPat

A single field in a struct pattern.

FnDecl

Header of a function declaration, without including the body.

ItemFn

A free-standing function: fn process(n: usize) -> Result<()> { ... }.

PatBox

A box pattern: box v.

PatIdent

A pattern that binds a new variable: ref mut binding @ SUBPATTERN.

PatLit

A literal pattern: 0.

PatMacro

A macro in expression position.

PatPath

A path pattern like Color::Red, optionally qualified with a self-type.

PatRange

A range pattern: 1..=2.

PatRef

A reference pattern: &mut (first, second).

PatSlice

A dynamically sized slice pattern: [a, b, i.., y, z].

PatStruct

A struct or struct variant pattern: Variant { x, y, .. }.

PatTuple

A tuple pattern: (a, b).

PatTupleStruct

A tuple struct or tuple variant pattern: Variant(x, y, .., z).

PatVerbatim

Tokens in pattern position not interpreted by Syn.

PatWild

A pattern that matches any value: _.

Enums

FnArg

An argument in a function signature: the n: usize in fn f(n: usize).

Pat

A pattern in a local binding, function signature, match expression, or various other places.

RangeLimits

Limit types of a range, inclusive or exclusive.