config-load 0.1.1

Conditional configuration loader for Rust applications that use the `config` crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::path::PathBuf;

use either::Either;

pub mod file;

pub trait Location {
    fn try_into_path(self) -> Either<PathBuf, Self>
    where
        Self: Sized;
}

impl<T: TryInto<PathBuf, Error = T>> Location for T {
    fn try_into_path(self) -> Either<PathBuf, Self> {
        self.try_into().map(Either::Left).unwrap_or_else(Either::Right)
    }
}