fix_getters_utils/collectors/
syntax_tree.rs

1//! A [`Getter`](crate::Getter)s collector visting a [`SyntaxTree`](syn::File).
2
3use crate::{GetterCollection, IdentificationMode};
4use std::path::Path;
5
6/// A [`Getter`](crate::Getter)s collector visting a [`SyntaxTree`](syn::File).
7///
8/// A [`SyntaxTree`](syn::File) is obtained by parsing a code source with [`syn`].
9/// They contain more syntatical information than a [`TokenStream`](proc_macro2::TokenStream),
10/// however, they imply the syntax is valid. For macros, use a
11/// [`TokenStreamGetterCollector`](super::TokenStreamGetterCollector) and
12/// for documentation code, use a [`DocCodeGetterCollector`](super::DocCodeGetterCollector).
13pub trait SyntaxTreeGetterCollector: for<'ast> syn::visit::Visit<'ast> {
14    /// Type for the [`GetterCollection`] used by this [`SyntaxTreeGetterCollector`].
15    type GetterCollection: GetterCollection;
16
17    /// Visits the `syntax_tree` collecting [`Getter`](crate::Getter)s
18    /// in the [`GetterCollection`].
19    fn collect(
20        path: &Path,
21        syntax_tree: &syn::File,
22        identification_mode: IdentificationMode,
23        getter_collection: &Self::GetterCollection,
24    );
25}