pub struct ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where
    S: Set,
    U: Infer + 'static,
    T: ErasedTy,
    U::Val: RawValParser,
    I: HandlerCollection<'a, S, Ser>,
    SetOpt<S>: Opt,
    SetCfg<S>: ConfigValue + Default,{ /* private fields */ }
Expand description

Simple wrapped the option create interface of Commit, and the handler register interface of HandlerEntry.

Implementations§

source§

impl<'a, 'b, I, S, Ser, U, T> ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source

pub fn new(inner: SetCommitWithValue<'b, S, U, T>, inv_ser: &'b mut I) -> Self

source

pub fn inner(&self) -> Result<&SetCommitWithValue<'b, S, U, T>, Error>

source

pub fn inner_mut( &mut self ) -> Result<&mut SetCommitWithValue<'b, S, U, T>, Error>

source

pub fn set_infer<O: Infer>( self ) -> ParserCommitWithValue<'a, 'b, I, S, Ser, O, T>where O::Val: RawValParser,

Set the infer type of option.

source

pub fn on<H, O, A>( self, handler: H ) -> Result<HandlerEntryThen<'a, 'b, I, S, Ser, H, A, O>, Error>where O: ErasedTy, H: Handler<S, Ser, A, Output = Option<O>, Error = Error> + 'a, A: Extract<S, Ser, Error = Error> + 'a,

Register the handler which will be called when option is set. The function will register the option to Set first, then pass the unqiue id to HandlerEntry.

source

pub fn fallback<H, O, A>( self, handler: H ) -> Result<HandlerEntryThen<'a, 'b, I, S, Ser, H, A, O>, Error>where O: ErasedTy, H: Handler<S, Ser, A, Output = Option<O>, Error = Error> + 'a, A: Extract<S, Ser, Error = Error> + 'a,

Register the handler which will be called when option is set. And the fallback will be called if the handler return None. The function will register the option to Set first, then pass the unqiue id to HandlerEntry.

source

pub fn run(self) -> Result<Uid, Error>

Run the commit.

It create an option using given type Ctor. And add it to referenced Set, return the new option Uid.

source§

impl<'a, 'b, I, S, Ser, U, T> ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source

pub fn set_validator(self, validator: ValValidator<U::Val>) -> Self

Set the option value validator.

source§

impl<'a, 'b, I, S, Ser, U, T> ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy, U::Val: Clone + RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source

pub fn set_value(self, value: U::Val) -> Self

Set the option default value.

source

pub fn set_values(self, value: Vec<U::Val>) -> Self

Set the option default value.

source§

impl<'a, 'b, I, S, Ser, U, T> ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy + RawValParser, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source

pub fn set_validator_t(self, validator: ValValidator<T>) -> Self

Set the option value validator.

source

pub fn add_default_storer_t(self) -> Self

Add default storer of type T.

source§

impl<'a, 'b, I, S, Ser, U, T> ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy + Clone, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source

pub fn set_value_t(self, value: T) -> Self

Set the option default value.

source

pub fn set_values_t(self, value: Vec<T>) -> Self

Set the option default value.

source

pub fn add_default_initializer_t(self) -> Self

Add a default initializer.

Trait Implementations§

source§

impl<'a, 'b, I, S, Ser, U, T> Commit<S> for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where S: Set, U: Infer + 'static, T: ErasedTy, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser>, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default,

source§

fn cfg(&self) -> &SetCfg<S>

source§

fn cfg_mut(&mut self) -> &mut SetCfg<S>

source§

fn set_index(self, index: Index) -> Self

source§

fn set_action(self, action: Action) -> Self

source§

fn set_name(self, name: impl Into<Str>) -> Self

source§

fn set_ctor(self, ctor: impl Into<Str>) -> Self

source§

fn clr_alias(self) -> Self

source§

fn rem_alias(self, alias: impl Into<Str>) -> Self

source§

fn add_alias(self, alias: impl Into<Str>) -> Self

source§

fn set_force(self, force: bool) -> Self

source§

fn set_hint(self, hint: impl Into<Str>) -> Self

source§

fn set_help(self, help: impl Into<Str>) -> Self

source§

fn set_storer(self, storer: ValStorer) -> Self

source§

fn set_initializer<T: Into<ValInitializer>>(self, initializer: T) -> Self

source§

impl<'a, 'b, I, S, Ser, U, T> Debug for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where U: Infer + 'static, T: ErasedTy, S: Set + Debug, U::Val: RawValParser, I: HandlerCollection<'a, S, Ser> + Debug, SetOpt<S>: Opt, SetCfg<S>: ConfigValue + Default + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b, I, S, Ser, U, T> RefUnwindSafe for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where I: RefUnwindSafe, S: RefUnwindSafe, Ser: RefUnwindSafe, T: RefUnwindSafe, U: RefUnwindSafe, <<S as Set>::Ctor as Ctor>::Config: RefUnwindSafe,

§

impl<'a, 'b, I, S, Ser, U, T> Send for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where I: Send, S: Send, Ser: Send, T: Send, U: Send, <<S as Set>::Ctor as Ctor>::Config: Send,

§

impl<'a, 'b, I, S, Ser, U, T> Sync for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where I: Sync, S: Sync, Ser: Sync, T: Sync, U: Sync, <<S as Set>::Ctor as Ctor>::Config: Sync,

§

impl<'a, 'b, I, S, Ser, U, T> Unpin for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>where Ser: Unpin, T: Unpin, U: Unpin, <<S as Set>::Ctor as Ctor>::Config: Unpin,

§

impl<'a, 'b, I, S, Ser, U, T> !UnwindSafe for ParserCommitWithValue<'a, 'b, I, S, Ser, U, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.
source§

impl<T> ErasedTy for Twhere T: Any + 'static,