Struct scalp::Builder

source ·
pub struct Builder<S, P = At<()>> { /* private fields */ }

Implementations§

source§

impl<S, P> Builder<S, P>

source

pub fn pipe<Q>(self, pipe: impl FnOnce(Self) -> Builder<S, Q>) -> Builder<S, Q>

source§

impl<S, P> Builder<S, P>

source

pub fn map<T, F: Fn(P::Value) -> T>( self, map: F ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<T, Error>>>
where P: Parse,

source

pub fn try_map<T, F: Fn(P::Value) -> Result<T, Error>>( self, map: F ) -> Builder<S, Map<P, F>>
where P: Parse,

source

pub fn filter( self, filter: impl Fn(&P::Value) -> bool ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<Option<P::Value>, Error>>>
where P: Parse,

source

pub fn filter_or( self, error: impl Into<Error>, filter: impl Fn(&P::Value) -> bool ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<P::Value, Error>>>
where P: Parse,

source

pub fn or<T>( self, error: impl Into<Error> ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<T, Error>>>
where P: Parse<Value = Option<T>>,

source

pub fn boxed( self ) -> Builder<S, Box<dyn Parse<Value = P::Value, State = P::State>>>
where P: Parse + 'static,

source

pub fn any<T>( self ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<Option<T>, Error>>>
where P: Parse, P::Value: Any<T>,

source

pub fn any_or<T>( self, error: impl Into<Error> ) -> Builder<S, Map<P, impl Fn(P::Value) -> Result<T, Error>>>
where P: Parse, P::Value: Any<T>,

source§

impl<S: Scope, P> Builder<S, P>

source

pub fn help(self, help: impl Into<Cow<'static, str>>) -> Self

source

pub fn note(self, note: impl Into<Cow<'static, str>>) -> Self

source

pub fn hide(self) -> Self

source

pub fn show(self) -> Self

source§

impl<S: Node, P> Builder<S, P>

source

pub fn usage(self, usage: impl Into<Cow<'static, str>>) -> Self

source

pub fn group<Q>( self, build: impl FnOnce(Builder<Group, At>) -> Builder<Group, Q> ) -> Builder<S, P::Push<Q>>
where P: Stack,

source

pub fn verb<Q>( self, build: impl FnOnce(Builder<Verb, At>) -> Builder<Verb, Q> ) -> Builder<S, P::Push<Node<Q>>>
where P: Stack,

source

pub fn option<T: FromStr + 'static, Q>( self, build: impl FnOnce(Builder<Option, Value<T>>) -> Builder<Option, Q> ) -> Builder<S, P::Push<With<Q>>>
where P: Stack,

source

pub fn options(self, options: impl IntoIterator<Item = Options>) -> Self

source§

impl<S: Version, P> Builder<S, P>

source

pub fn version(self, version: impl Into<Cow<'static, str>>) -> Self

source§

impl Builder<Root>

source

pub fn new() -> Self

source

pub fn case(self, case: Case) -> Self

source

pub fn prefix( self, short: impl Into<Cow<'static, str>>, long: impl Into<Cow<'static, str>> ) -> Self

source§

impl<P> Builder<Root, P>

source

pub fn build(self) -> Result<Parser<Node<P>>, Error>
where P: Parse,

source

pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self

source

pub fn license( self, name: impl Into<Cow<'static, str>>, file: impl Into<Cow<'static, str>> ) -> Self

source

pub fn author(self, author: impl Into<Cow<'static, str>>) -> Self

source§

impl<P> Builder<Group, P>

source

pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self

source§

impl<P> Builder<Verb, P>

source

pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self

source§

impl Builder<Option, Value<Unit>>

source

pub fn parse<T: FromStr + 'static>(self) -> Builder<Option, Value<T>>

source§

impl<P> Builder<Option, P>

source

pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self

source

pub fn position(self) -> Self

source

pub fn swizzle(self) -> Self
where P: Parse, <P as Parse>::Value: Flag,

source

pub fn default<T: Clone + Debug>( self, default: impl Into<T> ) -> Builder<Option, Default<P, impl Fn() -> T>>
where P: Parse<Value = Option<T>>,

source

pub fn default_with<T, F: Fn() -> T>( self, default: F, format: impl Into<Cow<'static, str>> ) -> Builder<Option, Default<P, F>>
where P: Parse<Value = Option<T>>,

source

pub fn environment<T: FromStr>( self, variable: impl Into<Cow<'static, str>> ) -> Builder<Option, Environment<P, impl Fn(&str) -> Option<T>>>
where P: Parse<Value = Option<T>>,

source

pub fn environment_with<T, F: Fn(&str) -> Option<T>>( self, variable: impl Into<Cow<'static, str>>, parse: F ) -> Builder<Option, Environment<P, F>>
where P: Parse<Value = Option<T>>,

source

pub fn require(self) -> Builder<Option, Require<P>>

source

pub fn many<T, I: Default + Extend<T>>( self ) -> Builder<Option, Many<P, I, impl Fn() -> I, impl Fn(&mut I, T)>>
where P: Parse<Value = Option<T>>,

source

pub fn many_with<T, I, N: Fn() -> I, F: Fn(&mut I, T)>( self, per: Option<NonZeroUsize>, new: N, add: F ) -> Builder<Option, Many<P, I, N, F>>
where P: Parse<Value = Option<T>>,

source

pub fn valid(self, pattern: impl Into<Cow<'static, str>>) -> Self

Trait Implementations§

source§

impl Default for Builder<Root>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, P> RefUnwindSafe for Builder<S, P>

§

impl<S, P> Send for Builder<S, P>
where P: Send, S: Send,

§

impl<S, P> Sync for Builder<S, P>
where P: Sync, S: Sync,

§

impl<S, P> Unpin for Builder<S, P>
where P: Unpin, S: Unpin,

§

impl<S, P> UnwindSafe for Builder<S, P>
where P: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.