Move from err-derive to thiserror
This commit is contained in:
parent
e5e46d6c1b
commit
1b4377715f
|
@ -11,7 +11,7 @@ documentation = "https://docs.rs/word-segmenters"
|
|||
|
||||
[dependencies]
|
||||
ahash = "0.5.7"
|
||||
err-derive = "0.2.4"
|
||||
thiserror = "1.0.22"
|
||||
|
||||
[dev-dependencies]
|
||||
bencher = "0.1.5"
|
||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -8,7 +8,7 @@ use std::{
|
|||
};
|
||||
|
||||
use ahash::AHashMap as HashMap;
|
||||
use err_derive::Error;
|
||||
use thiserror::Error;
|
||||
|
||||
pub struct Segmenter {
|
||||
unigrams: HashMap<String, f64>,
|
||||
|
@ -246,11 +246,11 @@ fn clean(s: &str) -> String {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ParseError {
|
||||
#[error(display = "I/O error: {}", _0)]
|
||||
Io(#[source] io::Error),
|
||||
#[error(display = "integer parsing error: {}", _0)]
|
||||
ParseInt(#[source] ParseIntError),
|
||||
#[error(display = "{}", _0)]
|
||||
#[error("I/O error: {0}")]
|
||||
Io(#[from] io::Error),
|
||||
#[error("integer parsing error: {0}")]
|
||||
ParseInt(#[from] ParseIntError),
|
||||
#[error("{0}")]
|
||||
String(String),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue