torrent_name_parser/
error.rs

1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct ErrorMatch {
6    matches: Vec<(&'static str, Option<String>)>,
7}
8
9impl ErrorMatch {
10    pub fn new(matches: Vec<(&'static str, Option<String>)>) -> ErrorMatch {
11        ErrorMatch { matches }
12    }
13}
14
15impl fmt::Display for ErrorMatch {
16    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17        write!(f, "{:?}", self.matches)
18    }
19}
20
21impl Error for ErrorMatch {
22    fn description(&self) -> &str {
23        "Couldn't find a title."
24    }
25}