Skip to main content

Module generics

Module generics 

Source

Structsยง

GenericArgsPropagationDetails ๐Ÿ”’
GenericsGenerationResult ๐Ÿ”’
GenericsGenerationResults ๐Ÿ”’

Enumsยง

DelegationGenerics ๐Ÿ”’
HirOrTyGenerics ๐Ÿ”’
Used for storing either ty generics or their uplifted HIR version. First we obtain ty generics. Next, at some point of generics processing we need to uplift those generics to HIR, for this purpose we use into_hir_generics that uplifts ty generics and replaces Ty variant with Hir. Such approach is useful as we can call this method at any time knowing that uplifting will occur at most only once. Then, in order to obtain generic params or args we use hir_generics_or_empty or into_generic_args functions. There also may be situations when we obtained ty generics but never uplifted them to HIR, meaning we did not propagate them and thus we do not need to generate generic params (i.e., method call scenarios), in such a case this approach helps a lot as if into_hir_generics will not be called then uplifting will not happen.