fix_getters_utils/collectors/
token_stream.rs

1//! A [`Getter`](crate::Getter)s collector visting a [`TokenStream`](proc_macro2::TokenStream).
2
3use std::path::Path;
4
5use crate::{GetterCollection, IdentificationMode, Scope};
6
7/// A [`Getter`](crate::Getter)s collector visting a [`TokenStream`](proc_macro2::TokenStream).
8///
9/// A [`TokenStream`](proc_macro2::TokenStream) is provided by [`syn`] when a macro is encountered.
10///
11/// This is also useful to parse documentation, once the different lines of the documentation
12/// and the code it contains is gethered together. Use a [`DocCodeGetterCollector`](super::DocCodeGetterCollector)
13/// for that.
14///
15/// For regular Rust code, it is easier to work on a [`SyntaxTree`](syn::File) using
16/// a [`SyntaxTreeGetterCollector`](crate::DocCodeGetterCollector).
17pub trait TokenStreamGetterCollector {
18    /// Type for the [`GetterCollection`] used by this [`TokenStreamGetterCollector`].
19    type GetterCollection: GetterCollection;
20
21    /// Parses the [`TokenStream`](proc_macro2::TokenStream) collecting [`Getter`](crate::Getter)s
22    /// in the [`GetterCollection`].
23    fn collect(
24        path: &Path,
25        scope: &Scope,
26        stream: &proc_macro2::TokenStream,
27        identification_mode: IdentificationMode,
28        getter_collection: &Self::GetterCollection,
29    );
30}