[−][src]Struct proffer::trait_gen::Trait
Represents a trait
block.
Example
use proffer::*; let tr8t = Trait::new("Foo") .add_signature(FunctionSignature::new("bar")) .to_owned(); let expected = r#" trait Foo { fn bar() -> (); } "#; assert_eq!( norm_whitespace(expected), norm_whitespace(tr8t.generate().as_str()) )
Methods
impl Trait
[src]
pub fn new<S: ToString>(name: S) -> Self
[src]
Create a new trait
pub fn add_signature(&mut self, signature: FunctionSignature) -> &mut Self
[src]
Add a new signature requirement to this trait.
pub fn set_is_pub(&mut self, is_pub: bool) -> &mut Self
[src]
Set if this is a pub
trait
pub fn add_generic(&mut self, generic: Generic) -> &mut Self
[src]
Add a generic bound to this trait.
pub fn add_associated_type(
&mut self,
associated_type: AssociatedTypeDeclaration
) -> &mut Self
[src]
&mut self,
associated_type: AssociatedTypeDeclaration
) -> &mut Self
Add a associated type to this trait.
Trait Implementations
impl SrcCode for Trait
[src]
impl Clone for Trait
[src]
impl Default for Trait
[src]
impl Serialize for Trait
[src]
Auto Trait Implementations
impl Send for Trait
impl Sync for Trait
impl Unpin for Trait
impl UnwindSafe for Trait
impl RefUnwindSafe for Trait
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,