Crate syn_select

source ·
Expand description

Library to get a specific element by path in Rust code.

Usage

let file: syn::File = syn::parse_str(
    r#"
    mod a {
        mod b {
            trait C {
                fn d(self) {}
                fn f() {}
            }
        }
    }"#).unwrap();
let results = syn_select::select("a::b::C::d", &file).unwrap();
assert_eq!(results.len(), 1);

Structs

  • An error encountered while parsing or executing a selector.
  • The path provided by the user to search for.

Functions

  • Parse a path, then search a file for all results that exactly match the specified path.