/// The goal of tracing generic parameter usage. /// /// Not all uses of type parameters imply a need to add bounds to a generated trait impl. /// For example, a field of type `<Vec<T> as a::b::Trait>::Associated` does not need a /// `where T: Serialize` bound in `serde`. /// However, a proc macro that is attempting to generate a helper struct _would_ need to /// know about this usage, or else the generated code would reference an unknown type `T` /// and fail to compile. #[derive(Debug, Copy, Clone, PartialEq, Eq)] pubenum Purpose { /// The tracing is being used to generate an `impl` block. /// /// Uses such as `syn::TypePath.qself` will _not_ be returned.
BoundImpl, /// The tracing is being used to generate a new struct or enum. /// /// All uses will be returned.
Declare,
}
/// Control struct for searching type parameters. /// /// This acts as the search context, preserving information that might have been /// kept on a visitor in a different implementation. /// Trait implementers are required to pass this through on any invocations they make. /// /// # Usage /// For extensibility, `Options` hides all of its fields from consumers. /// To create an instance, use the `From<Purpose>` trait implementation: /// /// ```rust /// # use darling_core::usage::{Options, Purpose}; /// let opts: Options = Purpose::BoundImpl.into(); /// assert!(!opts.include_type_path_qself()); /// ``` #[derive(Debug, Clone)] pubstruct Options {
purpose: Purpose, #[doc(hidden)]
__nonexhaustive: (),
}
impl Options { /// Returns `true` if the implementer of `UseTypeParams` should search /// `<___ as ...>::...` when looking for type parameter uses. pubfn include_type_path_qself(&self) -> bool { self.purpose == Purpose::Declare
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-23)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.