1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use key_path::KeyPath;
use crate::path::error::IntoPathedValueError;

pub type Result<T> = std::result::Result<T, crate::path::Error>;

pub trait IntoPathedValueResult<T> {
    fn into_pathed_value_result(self, path: KeyPath) -> Result<T>;
}

impl<T> IntoPathedValueResult<T> for teo_result::Result<T> {

    fn into_pathed_value_result(self, path: KeyPath) -> Result<T> {
        match self {
            Ok(t) => Ok(t),
            Err(e) => Err(e.into_pathed_value_error(path)),
        }
    }
}