Crate syn_mid

Source
Expand description

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. These are defined in this crate because they cannot be used in syn without “full” feature.

§Usage

Add this to your Cargo.toml:

[dependencies]
syn-mid = "0.5"

Compiler support: requires rustc 1.56+

Examples

§Optional features

  • clone-impls — Clone impls for all syntax tree types.

Re-exports§

pub use syn::ExprPath as PatPath;

Structs§

Block
A braced block containing Rust statements.
FieldPat
A single field in a struct pattern.
ItemFn
A free-standing function: fn process(n: usize) -> Result<()> { ... }.
PatIdent
A pattern that binds a new variable: ref mut binding @ SUBPATTERN.
PatReference
A reference pattern: &mut var.
PatRest
The dots in a tuple pattern: [0, 1, ..].
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).
PatType
A type ascription pattern: foo: f64.
PatWild
A pattern that matches any value: _.
Receiver
The self argument of an associated method, whether taken by value or by reference.
Signature
A function signature in a trait or implementation: unsafe fn initialize(&self).
Variadic
The variadic argument of a foreign function.

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.