diff options
Diffstat (limited to 'crates/core/tedge_core/src/utils.rs')
-rw-r--r-- | crates/core/tedge_core/src/utils.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/core/tedge_core/src/utils.rs b/crates/core/tedge_core/src/utils.rs new file mode 100644 index 00000000..eae68c6b --- /dev/null +++ b/crates/core/tedge_core/src/utils.rs @@ -0,0 +1,18 @@ +pub trait MakeCommaSeperatedString { + fn comma_seperated(self) -> CommaSeperatedString; +} + +impl MakeCommaSeperatedString for Vec<String> { + fn comma_seperated(self) -> CommaSeperatedString { + CommaSeperatedString(self.join(", ")) + } +} + +#[derive(Debug)] +pub struct CommaSeperatedString(String); + +impl std::fmt::Display for CommaSeperatedString { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} |