diff options
| author | Botahamec <botahamec@outlook.com> | 2023-08-08 21:24:57 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2023-08-08 21:24:57 -0400 |
| commit | 4e25a60d0f18aafab53a82a79e0ac10a0de2d6c4 (patch) | |
| tree | b0239aa992c7e5a801ee5d8b659b4bc6a9c76ff0 /src/unexpected.rs | |
| parent | db8110aa743c2cd85f4dee2abdd6856312bdd523 (diff) | |
Add From string conversions for UnexpectedError
Diffstat (limited to 'src/unexpected.rs')
| -rw-r--r-- | src/unexpected.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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<RawUnexpected> for UnexpectedError { } } +impl From<&'static str> for UnexpectedError { + fn from(value: &'static str) -> Self { + Self(RawUnexpected::msg(value)) + } +} + +impl From<String> 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) |
