Trait parkour::FromInputValue [−][src]
Trait for parsing a value. A value can be
- a positional argument
- a string following a flag; e.g in
--foo bar
or--foo=bar
, thebar
part is a value. A flag can be followed by multiple values, e.g.--foo bar baz
or--foo=bar,baz
To parse values, they are first converted to a string slice. By default, an
argument that starts with a dash can't be parsed as a value, unless you
implement the allow_leading_dashes
method.
Associated Types
Loading content...Required methods
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
The function that parses the string. This function is usually not
invoked directly. Instead you can use Parse::parse_value
and
Parse::try_parse_value
:
let mut input = parkour::parser(); let n: i32 = input.parse_value(&NumberCtx { min: -1000, max: 1000 })?;
Provided methods
fn allow_leading_dashes(_context: &Self::Context) -> bool
[src]
This function specifies whether this argument may start with leading
dashes. For example, this returns true
for numbers that can be
negative. The default is false
.
Implementations on Foreign Types
impl<T: FromInputValue, const N: usize> FromInputValue for [T; N]
[src]
type Context = ArrayCtx<T::Context>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl FromInputValue for bool
[src]
impl FromInputValue for char
[src]
impl<T: FromInputValue<Context = C>, C> FromInputValue for Vec<T>
[src]
type Context = ListCtx<C>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T: FromInputValue<Context = C>, C> FromInputValue for VecDeque<T>
[src]
type Context = ListCtx<C>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T: FromInputValue<Context = C>, C> FromInputValue for LinkedList<T>
[src]
type Context = ListCtx<C>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T: FromInputValue<Context = C> + Ord, C> FromInputValue for BTreeSet<T>
[src]
type Context = ListCtx<C>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T: FromInputValue<Context = C> + Hash + Eq, C> FromInputValue for HashSet<T>
[src]
type Context = ListCtx<C>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl FromInputValue for i8
[src]
type Context = NumberCtx<i8>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for i16
[src]
type Context = NumberCtx<i16>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for i32
[src]
type Context = NumberCtx<i32>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for i64
[src]
type Context = NumberCtx<i64>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for i128
[src]
type Context = NumberCtx<i128>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for isize
[src]
type Context = NumberCtx<isize>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroI8
[src]
type Context = NumberCtx<NonZeroI8>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroI16
[src]
type Context = NumberCtx<NonZeroI16>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroI32
[src]
type Context = NumberCtx<NonZeroI32>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroI64
[src]
type Context = NumberCtx<NonZeroI64>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroI128
[src]
type Context = NumberCtx<NonZeroI128>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroIsize
[src]
type Context = NumberCtx<NonZeroIsize>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for u8
[src]
type Context = NumberCtx<u8>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for u16
[src]
type Context = NumberCtx<u16>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for u32
[src]
type Context = NumberCtx<u32>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for u64
[src]
type Context = NumberCtx<u64>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for u128
[src]
type Context = NumberCtx<u128>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for usize
[src]
type Context = NumberCtx<usize>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroU8
[src]
type Context = NumberCtx<NonZeroU8>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroU16
[src]
type Context = NumberCtx<NonZeroU16>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroU32
[src]
type Context = NumberCtx<NonZeroU32>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroU64
[src]
type Context = NumberCtx<NonZeroU64>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroU128
[src]
type Context = NumberCtx<NonZeroU128>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for NonZeroUsize
[src]
type Context = NumberCtx<NonZeroUsize>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(_: &Self::Context) -> bool
[src]
impl FromInputValue for f32
[src]
type Context = NumberCtx<f32>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for f64
[src]
type Context = NumberCtx<f64>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for String
[src]
type Context = StringCtx
fn from_input_value(value: &str, context: &StringCtx) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for OsString
[src]
type Context = StringCtx
fn from_input_value(value: &str, context: &StringCtx) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for PathBuf
[src]
type Context = StringCtx
fn from_input_value(value: &str, context: &StringCtx) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl FromInputValue for Cow<'static, str>
[src]
type Context = StringCtx
fn from_input_value(value: &str, context: &StringCtx) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T1: FromInputValue> FromInputValue for (T1,)
[src]
type Context = TupleCtx<(T1::Context,)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue> FromInputValue for (T1, T2)
[src]
type Context = TupleCtx<(T1::Context, T2::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue> FromInputValue for (T1, T2, T3)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue> FromInputValue for (T1, T2, T3, T4)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue, T8: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7, T8)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context, T8::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue, T8: FromInputValue, T9: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7, T8, T9)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context, T8::Context, T9::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue, T8: FromInputValue, T9: FromInputValue, T10: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context, T8::Context, T9::Context, T10::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue, T8: FromInputValue, T9: FromInputValue, T10: FromInputValue, T11: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context, T8::Context, T9::Context, T10::Context, T11::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T1: FromInputValue, T2: FromInputValue, T3: FromInputValue, T4: FromInputValue, T5: FromInputValue, T6: FromInputValue, T7: FromInputValue, T8: FromInputValue, T9: FromInputValue, T10: FromInputValue, T11: FromInputValue, T12: FromInputValue> FromInputValue for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
[src]
type Context = TupleCtx<(T1::Context, T2::Context, T3::Context, T4::Context, T5::Context, T6::Context, T7::Context, T8::Context, T9::Context, T10::Context, T11::Context, T12::Context)>
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
impl<T: FromInputValue> FromInputValue for Box<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for Rc<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for Arc<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for Cell<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for RefCell<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for UnsafeCell<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for Mutex<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for RwLock<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: FromInputValue> FromInputValue for ManuallyDrop<T>
[src]
type Context = T::Context
fn from_input_value(value: &str, context: &Self::Context) -> Result<Self, Error>
[src]
fn allow_leading_dashes(context: &Self::Context) -> bool
[src]
impl<T: ToOwned> FromInputValue for Cow<'static, T> where
T::Owned: FromInputValue,
[src]
T::Owned: FromInputValue,