Move from err-derive to thiserror

This commit is contained in:
Dirkjan Ochtman 2020-11-23 13:23:16 +01:00
parent e5e46d6c1b
commit 1b4377715f
2 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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),
} }