vos_error/for_std/parse_error/
mod.rs1use std::fmt::Display;
2
3use super::*;
4
5impl From<ParseIntError> for VosError {
6 fn from(error: ParseIntError) -> Self {
7 Self::parse_error(error.to_string())
8 }
9}
10
11impl From<ParseFloatError> for VosError {
12 fn from(error: ParseFloatError) -> Self {
13 Self::parse_error(error.to_string())
14 }
15}
16
17impl VosError {
18 pub fn parse_error<S>(msg: S) -> Self
19 where
20 S: Display,
21 {
22 Self {
23 kind: Box::new(VosErrorKind::ParseError(msg.to_string())),
24 level: DiagnosticLevel::Error,
25 file: Default::default(),
26 }
27 }
28}