From 439b0ce3931ef61d105733024fb859140dfec6b4 Mon Sep 17 00:00:00 2001 From: Rak Laptudirm Date: Sat, 13 Apr 2024 23:39:46 +0530 Subject: [PATCH] chore: RunError is now purely a supertrait --- uai/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/uai/src/lib.rs b/uai/src/lib.rs index dbbeabf..6411a4e 100644 --- a/uai/src/lib.rs +++ b/uai/src/lib.rs @@ -96,7 +96,7 @@ impl Client { // Parsing complete, run the Command and handle any errors. match cmd.run(&context, flags) { Ok(_) => (), - Err(err) => match err.error() { + Err(err) => match err.into() { // Quit is a directive to quit the Client, so break // out of the main Command loop reading from stdin. RunErrorType::Quit => break, @@ -201,11 +201,9 @@ impl Command { /// RunError is the interface which the Client uses to understand custom errors /// returned by a Command. It allows the user to implement their own error types -/// while allowing the Client to interpret and use those errors. -pub trait RunError: Send + From { - /// error returns the current error as a [`RunErrorType`]. - fn error(&self) -> RunErrorType; -} +/// while allowing the Client to interpret and use those errors. This is +/// achieved by requiring conversions from and into [`RunErrorType`]. +pub trait RunError: Send + From + Into {} #[macro_export] macro_rules! quit {