node_maintainer/
into_kdl.rs1use kdl::KdlDocument;
2
3use crate::error::NodeMaintainerError;
4
5pub trait IntoKdl: IntoKdlSealed {}
6
7impl IntoKdl for KdlDocument {}
8impl IntoKdl for String {}
9impl<'a> IntoKdl for &'a str {}
10impl<'a> IntoKdl for &'a String {}
11
12impl IntoKdlSealed for KdlDocument {
13 fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
14 Ok(self)
15 }
16}
17
18impl IntoKdlSealed for String {
19 fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
20 Ok(self.parse()?)
21 }
22}
23
24impl<'a> IntoKdlSealed for &'a str {
25 fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
26 Ok(self.parse()?)
27 }
28}
29
30impl<'a> IntoKdlSealed for &'a String {
31 fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError> {
32 Ok(self.parse()?)
33 }
34}
35
36pub trait IntoKdlSealed {
37 fn into_kdl(self) -> Result<KdlDocument, NodeMaintainerError>;
38}