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 {