config_load/location.rs
1use std::path::PathBuf;
2
3use either::Either;
4
5pub mod file;
6
7pub trait Location {
8 fn try_into_path(self) -> Either<PathBuf, Self>
9 where
10 Self: Sized;
11}
12
13impl<T: TryInto<PathBuf, Error = T>> Location for T {
14 fn try_into_path(self) -> Either<PathBuf, Self> {
15 self.try_into().map(Either::Left).unwrap_or_else(Either::Right)
16 }
17}