TypeExt

Trait TypeExt 

Source
pub(crate) trait TypeExt {
    // Required method
    fn contains_type_structurally(&self, needle: &Type) -> bool;
}
Expand description

Extension of a syn::Type providing helper methods checking for structural inclusion of other types.

Required Methods§

Source

fn contains_type_structurally(&self, needle: &Type) -> bool

Checks whether the provided syn::Type is contained within this syn::Type structurally (part of the actual structure).

§False positives

This check naturally gives a false positive when a type parameter is not used directly in a field, but its associative type does (e.g. struct Foo<T: Some>(T::Assoc);). This is because the structure of the type cannot be scanned by its name only.

Implementations on Foreign Types§

Source§

impl TypeExt for Type

Source§

fn contains_type_structurally(&self, needle: &Self) -> bool

Implementors§