Skip to main content

Module generic

Module generic 

Source

Re-exportsยง

use std::ops::Not; ๐Ÿ”’
use rustc_ast::EnumDef; ๐Ÿ”’
use rustc_ast::Expr; ๐Ÿ”’
use rustc_ast::GenericParamKind; ๐Ÿ”’
use rustc_ast::Generics; ๐Ÿ”’
use rustc_ast::Param; ๐Ÿ”’
use rustc_ast::Safety; ๐Ÿ”’
use rustc_ast::VariantData; ๐Ÿ”’
use rustc_attr_ir::Attribute; ๐Ÿ”’
use rustc_attr_ir::AttributeKind; ๐Ÿ”’
use rustc_attr_ir::ReprPacked; ๐Ÿ”’
use rustc_attr_parsing::AttributeParser; ๐Ÿ”’
use rustc_expand::base::ExtCtxt; ๐Ÿ”’
use rustc_span::Ident; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use rustc_span::kw; ๐Ÿ”’
use rustc_span::sym; ๐Ÿ”’
use thin_vec::ThinVec; ๐Ÿ”’
use thin_vec::thin_vec; ๐Ÿ”’
use crate::util::generic_param_to_arg; ๐Ÿ”’
use crate::deriving; ๐Ÿ”’
use crate::diagnostics; ๐Ÿ”’
pub(crate) use rustc_ast as ast; ๐Ÿ”’
pub(crate) use Substructure::*; ๐Ÿ”’

Macrosยง

smallvec ๐Ÿ”’
Creates a SmallVec containing the arguments.

Structsยง

BlockOrExpr ๐Ÿ”’
The code snippets built up for derived code are sometimes used as blocks (e.g. in a function body) and sometimes used as expressions (e.g. in a match arm). This structure avoids committing to either form until necessary, avoiding the insertion of any unnecessary blocks.
FieldInfo ๐Ÿ”’
Summary of the relevant parts of a struct/enum field.
MethodDef ๐Ÿ”’
SmallVec ๐Ÿ”’
A Vec-like container that can store a small number of elements inline.
TraitDef ๐Ÿ”’
TypeParameter ๐Ÿ”’

Enumsยง

FieldlessVariantsStrategy ๐Ÿ”’
How to handle fieldless enum variants.
MethodBody ๐Ÿ”’
Substructure ๐Ÿ”’
A helper that makes the code for several derive macros easier to write as they all have a similar base structure.

Functionsยง

find_type_parameters ๐Ÿ”’
This method helps to extract all the type parameters referenced from a type. For a type parameter <T>, it looks for either a TyPath that is not global and starts with T, or a TyQPath. Also include bound generic params from the input type.
generics_without_defaults ๐Ÿ”’