pub struct ArgBuilder<'r, 'a, T> { /* private fields */ }
Expand description
Builder for providing additional argument information for error reporting.
Implementations§
Source§impl<'r, 'a, T> ArgBuilder<'r, 'a, T>
impl<'r, 'a, T> ArgBuilder<'r, 'a, T>
Sourcepub fn with_name<S: Into<Cow<'a, str>>>(self, name: S) -> Self
pub fn with_name<S: Into<Cow<'a, str>>>(self, name: S) -> Self
Provides a name for this argument. If an old name is already set, it is silently replaced. The name can either be borrowed from the environment or owned.
Sourcepub fn with_type_name<S: Into<Cow<'a, str>>>(self, ty: S) -> Self
pub fn with_type_name<S: Into<Cow<'a, str>>>(self, ty: S) -> Self
Provides a more readable type name for this argument. If an old name is
already set, it is silently replaced. If no type name is given, a value
from std::any::type_name
is used. The name can either be borrowed from
the environment or owned.
Source§impl<'r, 'a, T: FromVariant> ArgBuilder<'r, 'a, T>
impl<'r, 'a, T: FromVariant> ArgBuilder<'r, 'a, T>
Sourcepub fn get(self) -> Result<T, ArgumentError<'a>>
pub fn get(self) -> Result<T, ArgumentError<'a>>
Get the converted argument value.
§Errors
If the argument is missing, or cannot be converted to the desired type.
Sourcepub fn get_optional(self) -> Result<Option<T>, ArgumentError<'a>>
pub fn get_optional(self) -> Result<Option<T>, ArgumentError<'a>>
Get the argument as optional.
§Errors
If the argument is present, but cannot be converted to the desired type.
Auto Trait Implementations§
impl<'r, 'a, T> Freeze for ArgBuilder<'r, 'a, T>
impl<'r, 'a, T> RefUnwindSafe for ArgBuilder<'r, 'a, T>where
T: RefUnwindSafe,
impl<'r, 'a, T> Send for ArgBuilder<'r, 'a, T>where
T: Send,
impl<'r, 'a, T> Sync for ArgBuilder<'r, 'a, T>where
T: Sync,
impl<'r, 'a, T> Unpin for ArgBuilder<'r, 'a, T>where
T: Unpin,
impl<'r, 'a, T> !UnwindSafe for ArgBuilder<'r, 'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more