rubit_bencode/errors.rs
1use std::{num::ParseIntError, str::Utf8Error};
2
3#[derive(Debug)]
4pub enum ParseError {
5 Int(ParseIntError),
6 Str(Utf8Error),
7 BadFile,
8}
9
10impl From<Utf8Error> for ParseError {
11 fn from(error: Utf8Error) -> Self {
12 ParseError::Str(error)
13 }
14}
15
16impl From<ParseIntError> for ParseError {
17 fn from(error: ParseIntError) -> Self {
18 ParseError::Int(error)
19 }
20}