pub trait ItemImplExt {
// Required method
fn with_generics(self, generics: Generics) -> Self;
}
Expand description
Extension trait for ItemImpl
(impl block).
Required Methods§
sourcefn with_generics(self, generics: Generics) -> Self
fn with_generics(self, generics: Generics) -> Self
Instead of
ⓘ
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
let item: Item = Quote::new(def_site::<Span>())
.quote_with(smart_quote!(
Vars {
Type: type_name,
impl_generics,
ty_generics,
where_clause,
},
{
impl impl_generics ::swc_common::AstNode for Type ty_generics
where_clause {}
}
)).parse();
You can use this like
ⓘ
.quote_with(smart_quote!(Vars { Type: type_name }, {
impl ::swc_common::AstNode for Type {}
}))
.parse::<ItemImpl>()
.with_generics(input.generics);
Object Safety§
This trait is not object safe.