MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / fmt_fn

Function fmt_fn

crates/codegen/src/util.rs:38–46  ·  view source on GitHub ↗

Turns a closure `f: Fn(&mut Formatter) -> Result` into `fmt::Display`.

(f: impl Fn(&mut Formatter) -> Result)

Source from the content-addressed store, hash-verified

36
37/// Turns a closure `f: Fn(&mut Formatter) -> Result` into `fmt::Display`.
38pub(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
48pub(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())

Callers 4

cpp_ty_fmt_implFunction · 0.70
ty_fmtFunction · 0.70
ty_fmt_with_nsFunction · 0.70

Calls 1

FDisplayClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…