Turns a closure `f: Fn(&mut Formatter) -> Result` into `fmt::Display`.
(f: impl Fn(&mut Formatter) -> Result)
| 36 | |
| 37 | /// Turns a closure `f: Fn(&mut Formatter) -> Result` into `fmt::Display`. |
| 38 | pub(super) fn fmt_fn(f: impl Fn(&mut Formatter) -> Result) -> impl Display { |
| 39 | struct FDisplay<F>(F); |
| 40 | impl<F: Fn(&mut Formatter) -> Result> Display for FDisplay<F> { |
| 41 | fn fmt(&self, f: &mut Formatter<'_>) -> Result { |
| 42 | (self.0)(f) |
| 43 | } |
| 44 | } |
| 45 | FDisplay(f) |
| 46 | } |
| 47 | |
| 48 | pub(super) fn collect_case<'a>(case: Case, segs: impl Iterator<Item = &'a Identifier>) -> String { |
| 49 | segs.map(|s| s.deref().to_case(case)).join(case.delim()) |
no test coverage detected
searching dependent graphs…