Skip to main content

Visitor

Trait Visitor 

Source
pub trait Visitor<'arg> {
    type Value;

    // Required methods
    fn visit_positional(self, argument: &'arg Arg) -> Self::Value;
    fn visit_long_argument(
        self,
        flag: &'arg Arg,
        argument: &'arg Arg,
    ) -> Self::Value;
    fn visit_long(
        self,
        flag: &'arg Arg,
        arg: impl ArgAccess<'arg>,
    ) -> Self::Value;
    fn visit_short(self, flag: u8, arg: impl ArgAccess<'arg>) -> Self::Value;
}
Expand description

The ArgumentsParser type operates by passing arguments it finds into a Visitor, to be handled.

Required Associated Types§

Required Methods§

Source

fn visit_positional(self, argument: &'arg Arg) -> Self::Value

A positional parameter.

Source

fn visit_long_argument( self, flag: &'arg Arg, argument: &'arg Arg, ) -> Self::Value

A long flag that definitely has an argument, because it was given as --flag=argument

Source

fn visit_long(self, flag: &'arg Arg, arg: impl ArgAccess<'arg>) -> Self::Value

A long flag, such as --flag

Source

fn visit_short(self, flag: u8, arg: impl ArgAccess<'arg>) -> Self::Value

A long flag, such as -f

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§