[][src]Struct scones_examples::CustomArgs

pub struct CustomArgs {
    pub product: i32,
    pub sum: i32,
}

An example showing how to add extra arguments to a constructor and use those arguments to initialize the existing fields.

It is defined as follows:

#[make_constructor(pub new(a: i32, b: i32))]
/// ^ Returns a new instance of `CustomArgs` with `product` equal to `a * b` and `sum` equal to
/// ^ `a + b`.
pub struct CustomArgs {
    #[value(a * b)]
    pub product: i32,
    #[value(a + b)]
    pub sum: i32,
}

Note that if the #[value()] annotations were ommitted for any field, the macro would add that field as an additional argument to the constructor automatically.

Fields

product: i32sum: i32

Implementations

impl CustomArgs[src]

pub fn new(a: i32, b: i32) -> Self[src]

Returns a new instance of CustomArgs with product equal to a * b and sum equal to a + b.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.