[][src]Struct proffer::trait_gen::Trait

pub struct Trait { /* fields omitted */ }

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]

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]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]