Struct cor_args::ArgHandler
source · pub struct ArgHandler<'a> { /* private fields */ }Expand description
A handler for managing command-line arguments.
This struct is responsible for handling command-line arguments passed to the application. If a value for a given key is not found in the arguments, it delegates the request to the next handler (if provided).
Implementations§
source§impl<'a> ArgHandler<'a>
impl<'a> ArgHandler<'a>
sourcepub fn new(args: &'a ArgMatches) -> Self
pub fn new(args: &'a ArgMatches) -> Self
Creates a new ArgHandler with the specified arguments and an optional next handler.
Arguments
args- The parsed command-line arguments.next- An optional next handler to which requests can be delegated if this handler can’t fulfill them.
pub fn next(self, handler: Box<dyn Handler>) -> Self
Trait Implementations§
source§impl<'a> Handler for ArgHandler<'a>
impl<'a> Handler for ArgHandler<'a>
source§fn handle_request(&self, key: &str) -> Option<String>
fn handle_request(&self, key: &str) -> Option<String>
Retrieves a value for the specified key from the command-line arguments.
If the key is not found in the arguments, and if a next handler is provided, it delegates the request
to the next handler. If there’s no next handler or if the key is not found in both the arguments and
the next handler, it returns None.
Arguments
key- The key for which the value needs to be retrieved.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ArgHandler<'a>
impl<'a> !Send for ArgHandler<'a>
impl<'a> !Sync for ArgHandler<'a>
impl<'a> Unpin for ArgHandler<'a>
impl<'a> !UnwindSafe for ArgHandler<'a>
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