//! Argument related errors use super::*; use std::{ error, fmt, }; #[derive(Debug)] #[non_exhaustive] pub enum ParseErrorKind { ExpectedArg(String), UnknownOption(char), UnknownOptionFor(char, char), CannotCombine(char, char), BadTail(char, String), NotUnique(char), } impl From<(String, ParseErrorKind)> for Error { #[inline] fn from((froms, fromk): (String, ParseErrorKind)) -> Self { Self::Parse(froms, fromk) } } #[derive(Debug)] #[non_exhaustive] pub enum Error { Parse(String, ParseErrorKind), Unknown, AtomInternal, } impl error::Error for Error{} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { _ => write!(f, "unknown error"), } } } impl From> for Error { #[inline] fn from(_: tokio::sync::mpsc::error::SendError) -> Self { Self::AtomInternal } }