From 4e25a60d0f18aafab53a82a79e0ac10a0de2d6c4 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Tue, 8 Aug 2023 21:24:57 -0400 Subject: Add From string conversions for UnexpectedError --- src/unexpected.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/unexpected.rs') diff --git a/src/unexpected.rs b/src/unexpected.rs index 20a71c9..cc07728 100644 --- a/src/unexpected.rs +++ b/src/unexpected.rs @@ -214,6 +214,18 @@ impl From for UnexpectedError { } } +impl From<&'static str> for UnexpectedError { + fn from(value: &'static str) -> Self { + Self(RawUnexpected::msg(value)) + } +} + +impl From for UnexpectedError { + fn from(value: String) -> Self { + Self(RawUnexpected::msg(value)) + } +} + impl Display for UnexpectedError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Display::fmt(&self.0, f) -- cgit v1.2.3