[−][src]Struct rustc_builtin_macros::deriving::generic::TraitDef
Fields
span: SpanThe span for the current #[derive(Foo)] header.
attributes: Vec<Attribute>path: PathPath of the trait, including any type parameters
additional_bounds: Vec<Ty>Additional bounds required of any type parameters of the type, other than the current trait
generics: BoundsAny extra lifetimes and/or bounds, e.g., D: serialize::Decoder
is_unsafe: boolIs it an unsafe trait?
supports_unions: boolCan this trait be derived for unions?
methods: Vec<MethodDef<'a>>associated_types: Vec<(Ident, Ty)>Implementations
impl<'a> TraitDef<'a>[src]
pub fn expand(
self,
cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &'a Annotatable,
push: &mut dyn FnMut(Annotatable)
)[src]
self,
cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &'a Annotatable,
push: &mut dyn FnMut(Annotatable)
)
pub fn expand_ext(
self,
cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &'a Annotatable,
push: &mut dyn FnMut(Annotatable),
from_scratch: bool
)[src]
self,
cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &'a Annotatable,
push: &mut dyn FnMut(Annotatable),
from_scratch: bool
)
pub(in deriving::generic) fn create_derived_impl(
&self,
cx: &mut ExtCtxt<'_>,
type_ident: Ident,
generics: &Generics,
field_tys: Vec<P<Ty>>,
methods: Vec<P<AssocItem>>
) -> P<Item>[src]
&self,
cx: &mut ExtCtxt<'_>,
type_ident: Ident,
generics: &Generics,
field_tys: Vec<P<Ty>>,
methods: Vec<P<AssocItem>>
) -> P<Item>
Given that we are deriving a trait DerivedTrait for a type like:
ⓘThis example is not tested
struct Struct<'a, ..., 'z, A, B: DeclaredTrait, C, ..., Z> where C: WhereTrait { a: A, b: B::Item, b1: <B as DeclaredTrait>::Item, c1: <C as WhereTrait>::Item, c2: Option<<C as WhereTrait>::Item>, ... }
create an impl like:
ⓘThis example is not tested
impl<'a, ..., 'z, A, B: DeclaredTrait, C, ... Z> where C: WhereTrait, A: DerivedTrait + B1 + ... + BN, B: DerivedTrait + B1 + ... + BN, C: DerivedTrait + B1 + ... + BN, B::Item: DerivedTrait + B1 + ... + BN, <C as WhereTrait>::Item: DerivedTrait + B1 + ... + BN, ... { ... }
where B1, ..., BN are the bounds given by bounds_paths.'. Z is a phantom type, and
therefore does not get bound by the derived trait.
pub(in deriving::generic) fn expand_struct_def(
&self,
cx: &mut ExtCtxt<'_>,
struct_def: &'a VariantData,
type_ident: Ident,
generics: &Generics,
from_scratch: bool,
use_temporaries: bool
) -> P<Item>[src]
&self,
cx: &mut ExtCtxt<'_>,
struct_def: &'a VariantData,
type_ident: Ident,
generics: &Generics,
from_scratch: bool,
use_temporaries: bool
) -> P<Item>
pub(in deriving::generic) fn expand_enum_def(
&self,
cx: &mut ExtCtxt<'_>,
enum_def: &'a EnumDef,
type_ident: Ident,
generics: &Generics,
from_scratch: bool
) -> P<Item>[src]
&self,
cx: &mut ExtCtxt<'_>,
enum_def: &'a EnumDef,
type_ident: Ident,
generics: &Generics,
from_scratch: bool
) -> P<Item>
impl<'a> TraitDef<'a>[src]
pub(in deriving::generic) fn summarise_struct(
&self,
cx: &mut ExtCtxt<'_>,
struct_def: &VariantData
) -> StaticFields[src]
&self,
cx: &mut ExtCtxt<'_>,
struct_def: &VariantData
) -> StaticFields
pub(in deriving::generic) fn create_subpatterns(
&self,
cx: &mut ExtCtxt<'_>,
field_paths: Vec<Ident>,
mutbl: Mutability,
use_temporaries: bool
) -> Vec<P<Pat>>[src]
&self,
cx: &mut ExtCtxt<'_>,
field_paths: Vec<Ident>,
mutbl: Mutability,
use_temporaries: bool
) -> Vec<P<Pat>>
pub(in deriving::generic) fn create_struct_pattern(
&self,
cx: &mut ExtCtxt<'_>,
struct_path: Path,
struct_def: &'a VariantData,
prefix: &str,
mutbl: Mutability,
use_temporaries: bool
) -> (P<Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [Attribute])>)[src]
&self,
cx: &mut ExtCtxt<'_>,
struct_path: Path,
struct_def: &'a VariantData,
prefix: &str,
mutbl: Mutability,
use_temporaries: bool
) -> (P<Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [Attribute])>)
pub(in deriving::generic) fn create_enum_variant_pattern(
&self,
cx: &mut ExtCtxt<'_>,
enum_ident: Ident,
variant: &'a Variant,
prefix: &str,
mutbl: Mutability
) -> (P<Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [Attribute])>)[src]
&self,
cx: &mut ExtCtxt<'_>,
enum_ident: Ident,
variant: &'a Variant,
prefix: &str,
mutbl: Mutability
) -> (P<Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [Attribute])>)
Auto Trait Implementations
impl<'a> !RefUnwindSafe for TraitDef<'a>
impl<'a> !Send for TraitDef<'a>
impl<'a> !Sync for TraitDef<'a>
impl<'a> Unpin for TraitDef<'a>
impl<'a> !UnwindSafe for TraitDef<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,