Tracking Issue for debug_closure_helpers (original) (raw)

Feature gate: #![feature(debug_closure_helpers)]

This is a tracking issue for adding helpers to core::fmt that can use closures for formatting values.

ACP: rust-lang/libs-team#288

Public API

// core::fmt

impl DebugList<'_, '_> { fn entry_with(&mut self, entry_fmt: F) -> &mut Self where F: FnOnce(&mut Formatter) -> fmt::Result; }

impl DebugMap<'_, '_> { fn key_with(&mut self, key_fmt: F) -> &mut Self where F: FnOnce(&mut Formatter) -> fmt::Result;

fn value_with<F>(&mut self, value_fmt: F) -> &mut Self
where
    F: FnOnce(&mut Formatter) -> fmt::Result;

}

impl DebugSet<'_, '_> { fn entry_with(&mut self, entry_fmt: F) -> &mut Self where F: FnOnce(&mut Formatter) -> fmt::Result; }

impl DebugStruct<'_, '_> { fn field_with(&mut self, name: &str, field_fmt: F) -> &mut Self where F: FnOnce(&mut Formatter) -> fmt::Result; }

impl DebugTuple<'_, '_> { // also DebugSet fn field_with(&mut self, field_fmt: F) -> &mut Self where F: FnOnce(&mut Formatter) -> fmt::Result; }

Steps / History

Unresolved Questions

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html