diff options
Diffstat (limited to 'src/utils.rs')
-rw-r--r-- | src/utils.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/utils.rs b/src/utils.rs index 8928cfb..828ae46 100644 --- a/src/utils.rs +++ b/src/utils.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::path::PathBuf; | 1 | use std::path::{Path, PathBuf}; |
2 | 2 | ||
3 | pub fn pandoc_stringify(inlines: &[pandoc_ast::Inline]) -> String { | 3 | pub fn pandoc_stringify(inlines: &[pandoc_ast::Inline]) -> String { |
4 | fn pandoc_stringify_(result: &mut String, inlines: &[pandoc_ast::Inline]) { | 4 | fn pandoc_stringify_(result: &mut String, inlines: &[pandoc_ast::Inline]) { |
@@ -114,3 +114,19 @@ impl PandocOutputExt for pandoc::PandocOutput { | |||
114 | } | 114 | } |
115 | 115 | ||
116 | pub type PandocMeta = pandoc_ast::Map<String, pandoc_ast::MetaValue>; | 116 | pub type PandocMeta = pandoc_ast::Map<String, pandoc_ast::MetaValue>; |
117 | |||
118 | pub trait PathExt { | ||
119 | fn to_string(&self) -> String; | ||
120 | } | ||
121 | |||
122 | impl PathExt for Path { | ||
123 | fn to_string(&self) -> String { | ||
124 | self.to_str().expect("Path is not valid UTF-8").to_string() | ||
125 | } | ||
126 | } | ||
127 | |||
128 | impl PathExt for PathBuf { | ||
129 | fn to_string(&self) -> String { | ||
130 | self.to_str().expect("Path is not valid UTF-8").to_string() | ||
131 | } | ||
132 | } | ||