1use std::fmt::Display;
2
3use color_print::cformat;
4
5pub trait Notes: Iterator + Sized {
6 fn as_notes(self) -> impl Iterator<Item = String>
7 where
8 Self::Item: Display
9 {
10 self.map(|item| cformat!(" <c>→ <m>{}</>", item))
11 }
12}
13
14impl<I> Notes for I
15where
16 I: Iterator,
17 I::Item: Display,
18{}
19
20#[allow(unused)]
21pub trait Formater {
22 fn as_command(self) -> String;
23 fn as_tip(self) -> String;
24 fn as_tip_cotinuation(self) -> String;
25 fn concat(self, postfix: &'static str) -> String;
26}
27
28impl<D> Formater for D
29where
30 D: Display
31{
32 fn as_command(self) -> String {
33 cformat!(" <c>•</><g> {} </>", self)
34 }
35
36 fn as_tip(self) -> String {
37 cformat!("<g>✔</> {}", self)
38 }
39
40 fn as_tip_cotinuation(self) -> String {
41 format!(" {}", self)
42 }
43
44 fn concat(self, postfix: &'static str) -> String {
45 format!("{}{}", self, postfix)
46 }
47
48
49}