[][src]Struct scones_examples::OverridableBuilt

pub struct OverridableBuilt {
    pub defaults_to_zero: i32,
}

An example showing how to use overrides in builders.

Overrides are sugar for accomplishing the job the OptionalBuilt example does with less verbosity. This example is defined as follows:

#[make_builder(pub OverridableBuilder(defaults_to_zero?))]
pub struct OverridableBuilt {
    #[value(0)]
    pub defaults_to_zero: i32,
}

The resulting builder will allow building this struct without specifying a value for defaults_to_zero, in which case zero will be used. At the same time, it allows a user of the builder to override that default, without you having to explicitly add a custom parameter, give it an Option<> type, and unwrap_or it in the #[value()] annotation.

Fields

defaults_to_zero: i32

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.