pub fn load<T, P>(self, root: P) -> Result<T, LoadError<T::Error>>
    where
        T: Loadable,
        P: AsRef<Path>,
    {
        match self {
            External::Path(path) => {
                let full_path = if path.is_relative() {
                    root.as_ref().join(&path)
                } else {
                    path
                };

                T::from_path(&full_path).map_err(move |error| LoadError::Failed {
                    error,
                    // We canonicalize `full_path` here, with `ReadFileError` we get extra
                    // information about the absolute path this way if the latter is relative. It
                    // will still be relative if the current path does not exist.
                    path: full_path.canonicalize().unwrap_or(full_path),
                })
            }
            External::Missing => Err(LoadError::Missing),
        }
    }
/// Loads the value if not loaded already, resolving relative paths from `root` or returns
/// available value. If the value is `Missing`, returns an error.
Loads the value if not loaded already, resolving relative paths from `root` or returns
available value. If the value is `Missing`, returns an error.
Loads the value if not loaded already resolving relative paths from ` root ` or returns available value . If the value is ` Missing ` returns an error .
pub fn load<T, P>(self, root: P) -> Result<T, LoadError<T::Error>>
    where
        T: Loadable,
        P: AsRef<Path>,
    {
        match self {
            External::Path(path) => {
                let full_path = if path.is_relative() {
                    root.as_ref().join(&path)
                } else {
                    path
                };
                T::from_path(&full_path).map_err(move |error| LoadError::Failed {
                    error,
                    // We canonicalize `full_path` here, with `ReadFileError` we get extra
                    // information about the absolute path this way if the latter is relative. It
                    // will still be relative if the current path does not exist.
                    path: full_path.canonicalize().unwrap_or(full_path),
                })
            }
            External::Missing => Err(LoadError::Missing),
        }
    }
pub fn load < T , P > ( self , root : P ) -> Result < T , LoadError < T :: Error > > where T : Loadable , P : AsRef < Path > , { match self { External :: Path ( path ) => { let full_path = if path . is_relative ( ) { root . as_ref ( ) . join ( & path ) } else { path } ; T :: from_path ( & full_path ) . map_err ( move | error | LoadError :: Failed { error , // We canonicalize `full_path` here, with `ReadFileError` we get extra // information about the absolute path this way if the latter is relative. It // will still be relative if the current path does not exist. path : full_path . canonicalize ( ) . unwrap_or ( full_path ) , } ) } External :: Missing => Err ( LoadError :: Missing ) , } }
Loads the value if not loaded already, resolving relative paths from `root` or returns
available value.
Loads the value if not loaded already resolving relative paths from ` root ` or returns available value .
self
root
P
self
root
P