Enum syn_helpers::TraitItem
source · pub enum TraitItem {
Method {
name: Ident,
generic_parameters: Option<Vec<GenericParam>>,
self_type: TypeOfSelf,
other_parameters: Vec<FnArg>,
return_type: Option<Type>,
handler: Box<dyn for<'a> Fn(Item<'a>) -> Result<Vec<Stmt>, Box<dyn Error>>>,
},
AssociatedFunction {
name: Ident,
generic_parameters: Option<Vec<GenericParam>>,
parameters: Vec<FnArg>,
return_type: Option<Type>,
handler: Box<dyn for<'a> Fn(&'a mut Structure) -> Result<Vec<Stmt>, Box<dyn Error>>>,
},
}
Expand description
A item under a trait
Variants§
Method
AssociatedFunction
Implementations§
source§impl TraitItem
impl TraitItem
sourcepub fn new_method(
name: Ident,
generic_parameters: Option<Vec<GenericParam>>,
self_type: TypeOfSelf,
other_parameters: Vec<FnArg>,
return_type: Option<Type>,
handler: impl for<'a> Fn(Item<'a>) -> Result<Vec<Stmt>, Box<dyn Error>> + 'static
) -> Self
pub fn new_method( name: Ident, generic_parameters: Option<Vec<GenericParam>>, self_type: TypeOfSelf, other_parameters: Vec<FnArg>, return_type: Option<Type>, handler: impl for<'a> Fn(Item<'a>) -> Result<Vec<Stmt>, Box<dyn Error>> + 'static ) -> Self
Create a new method (something that takes self
, &self
or &mut self
)
sourcepub fn new_associated_function(
name: Ident,
generic_parameters: Option<Vec<GenericParam>>,
parameters: Vec<FnArg>,
return_type: Option<Type>,
handler: impl for<'a> Fn(&'a mut Structure) -> Result<Vec<Stmt>, Box<dyn Error>> + 'static
) -> Self
pub fn new_associated_function( name: Ident, generic_parameters: Option<Vec<GenericParam>>, parameters: Vec<FnArg>, return_type: Option<Type>, handler: impl for<'a> Fn(&'a mut Structure) -> Result<Vec<Stmt>, Box<dyn Error>> + 'static ) -> Self
Create a new associated function (doesn’t take any reference of self)
Auto Trait Implementations§
impl !RefUnwindSafe for TraitItem
impl !Send for TraitItem
impl !Sync for TraitItem
impl Unpin for TraitItem
impl !UnwindSafe for TraitItem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more