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