1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! # Helpers to construct a Config
//!
//! The Config Trait is used to be able to pass your Config to the commands as well as use them for
//! the path of the session.
//!
//! <br>
//!
//! The simplest way is to use the Derive macro [`#[derive(ConfigDerive)]`](crate::config::ConfigDerive)
//!
//! It requires however that You also derive [Clone](std::clone::Clone), [Serialize](serde::Serialize)
//! and [Deserialize](serde::Deserialize).
//!
//! Also this only works for yaml config files. For any other format you will to implement the trait
//! yourself. However the crate still needs to implement [Clone](std::clone::Clone).
//!
//! ## Example
//!
//! ```compile_fail
//! use serde::{Deserialize, Serialize};
//! use std::borrow::Cow;
//!
//! #[derive(Debug, PartialEq, Serialize, Deserialize, Clone, ConfigDerive)]
//! pub struct Config<'a> {
//! pub homeserver_url: Cow<'a, str>,
//! pub mxid: Cow<'a, str>,
//! pub password: Cow<'a, str>,
//! pub store_path: Cow<'a, str>,
//! pub session_path: Cow<'a, str>,
//! }
//! ```
//!
use DeserializeOwned;
use Serialize;
use Path;
use crateConfigError;
pub use ConfigDerive;