Struct derive_utils::EnumImpl

source ·
pub struct EnumImpl<'a> { /* private fields */ }
Expand description

A builder for implementing a trait for enums.

Implementations§

source§

impl<'a> EnumImpl<'a>

source

pub fn new(data: &'a EnumData) -> Self

Creates a new EnumImpl.

source

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:

§Panics

Panics if a trait method has a body, no receiver, or a receiver other than the following:

  • &self
  • &mut self
  • self
source

pub fn set_trait(&mut self, path: Path)

source

pub fn push_generic_param(&mut self, param: GenericParam)

Appends a generic type parameter to the back of generics.

source

pub fn push_where_predicate(&mut self, predicate: WherePredicate)

Appends a predicate to the back of where-clause.

source

pub fn push_item(&mut self, item: ImplItem)

Appends an item to impl items.

source

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
source

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
source

pub fn build(self) -> TokenStream

source

pub fn build_impl(self) -> ItemImpl

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.