Struct ArgBuilder

Source
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>

Source

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.

Source

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

pub fn with_site(self, site: Site<'a>) -> Self

Provides a call site for this argument. If an old call site is already set, it is silently replaced. If given, the site will be used in case of error.

Source§

impl<'r, 'a, T: FromVariant> ArgBuilder<'r, 'a, T>

Source

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.

Source

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> 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>,

Source§

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>,

Source§

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.