jid: Rename Error::IcuError into Error::Stringprep

Avoir the "Error Error" pattern, and also use Stringprep instead of ICU

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-06-07 17:23:40 +02:00
parent 2cafecb004
commit 4701f6bb69

View file

@ -44,13 +44,13 @@ pub enum JidParseError {
#[cfg(feature = "icu")] #[cfg(feature = "icu")]
/// Happens when the JID is invalid according to stringprep. TODO: make errors /// Happens when the JID is invalid according to stringprep. TODO: make errors
/// meaningful. /// meaningful.
IcuError(icu::Error), Stringprep(icu::Error),
} }
#[cfg(feature = "icu")] #[cfg(feature = "icu")]
impl From<icu::Error> for JidParseError { impl From<icu::Error> for JidParseError {
fn from(e: icu::Error) -> JidParseError { fn from(e: icu::Error) -> JidParseError {
JidParseError::IcuError(e) JidParseError::Stringprep(e)
} }
} }
@ -67,7 +67,7 @@ impl fmt::Display for JidParseError {
JidParseError::EmptyNode => "nodepart empty despite the presence of a @", JidParseError::EmptyNode => "nodepart empty despite the presence of a @",
JidParseError::EmptyResource => "resource empty despite the presence of a /", JidParseError::EmptyResource => "resource empty despite the presence of a /",
#[cfg(feature = "icu")] #[cfg(feature = "icu")]
JidParseError::IcuError(_err) => "TODO", JidParseError::Stringprep(_err) => "TODO",
} }
) )
} }