pub struct EnumImpl<'a> { /* private fields */ }
Expand description
A builder for implementing a trait for enums.
Implementations§
Source§impl<'a> EnumImpl<'a>
impl<'a> EnumImpl<'a>
Sourcepub fn from_trait<I>(
data: &'a EnumData,
trait_path: &Path,
supertraits_types: I,
trait_def: ItemTrait,
) -> Self
pub fn from_trait<I>( data: &'a EnumData, trait_path: &Path, supertraits_types: I, trait_def: ItemTrait, ) -> Self
Creates a new EnumImpl
from a trait definition.
The following items are ignored:
- Generic associated types (GAT) (
TraitItem::Type
that has generics) TraitItem::Const
TraitItem::Macro
TraitItem::Verbatim
§Panics
Panics if a trait method has a body, no receiver, or a receiver other than the following:
&self
&mut self
self
pub fn set_trait(&mut self, path: Path)
Sourcepub fn push_generic_param(&mut self, param: GenericParam)
pub fn push_generic_param(&mut self, param: GenericParam)
Appends a generic type parameter to the back of generics.
Sourcepub fn push_where_predicate(&mut self, predicate: WherePredicate)
pub fn push_where_predicate(&mut self, predicate: WherePredicate)
Appends a predicate to the back of where
-clause.
Sourcepub fn push_method(&mut self, item: TraitItemFn)
pub fn push_method(&mut self, item: TraitItemFn)
Appends a method to impl items.
§Panics
Panics if a trait method has a body, no receiver, or a receiver other than the following:
&self
&mut self
self
Sourcepub fn append_items_from_trait(&mut self, trait_def: ItemTrait)
pub fn append_items_from_trait(&mut self, trait_def: ItemTrait)
Appends items from a trait definition to impl items.
§Panics
Panics if a trait method has a body, no receiver, or a receiver other than the following:
&self
&mut self
self
pub fn build(self) -> TokenStream
pub fn build_impl(self) -> ItemImpl
Auto Trait Implementations§
impl<'a> Freeze for EnumImpl<'a>
impl<'a> RefUnwindSafe for EnumImpl<'a>
impl<'a> !Send for EnumImpl<'a>
impl<'a> !Sync for EnumImpl<'a>
impl<'a> Unpin for EnumImpl<'a>
impl<'a> UnwindSafe for EnumImpl<'a>
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