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
use kdl::KdlDocument;
use crate::error::NodeMaintainerError;
pub trait IntoKdl: IntoKdlSealed {}
impl IntoKdl for KdlDocument {}
impl IntoKdl for String {}
impl<'a> IntoKdl for &'a str {}
impl<'a> IntoKdl for &'a String {}
impl IntoKdlSealed for KdlDocument {
fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
Ok(self)
}
}
impl IntoKdlSealed for String {
fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
Ok(self.parse()?)
}
}
impl<'a> IntoKdlSealed for &'a str {
fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
Ok(self.parse()?)
}
}
impl<'a> IntoKdlSealed for &'a String {
fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
Ok(self.parse()?)
}
}
pub trait IntoKdlSealed {
fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError>;
}