fromutf8error convert
This commit is contained in:
parent
dc17ebdb5d
commit
f698687a2d
10
src/error.rs
10
src/error.rs
|
@ -2,6 +2,7 @@ use std::{
|
|||
fmt::Display,
|
||||
io::{Error as IOError, ErrorKind},
|
||||
path::StripPrefixError,
|
||||
string::FromUtf8Error,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -67,6 +68,15 @@ impl From<Error> for IOError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<FromUtf8Error> for Error {
|
||||
fn from(value: FromUtf8Error) -> Self {
|
||||
Self {
|
||||
message: value.to_string(),
|
||||
source: Self::wrap(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static dyn std::error::Error> for Error {
|
||||
fn from(value: &'static dyn std::error::Error) -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Reference in a new issue