parcel 0.2.2
Wrappable, wire-transferable C++23 value system with JSON serialization
Loading...
Searching...
No Matches
format.h File Reference

std::formatter specializations for parcel::ICell and parcel::cell_t. More...

#include <parcel/cell.h>
#include <ostream>
#include <utility>
Include dependency graph for format.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Detailed Description

std::formatter specializations for parcel::ICell and parcel::cell_t.

Lets std::format("{}", cell) work on any cell. The empty spec calls to_string() (compact); the alt-form # flag calls to_formatted_string() (multi-line). Concrete cells derived from ICell are picked up via a constrained specialization.

Format specs supported on ICell / cell_t:

  • {} — compact to_string()
  • {:#} — multi-line to_formatted_string()
  • {:j} — compact JSON via to_json().dump()
  • {:j2} — pretty JSON via to_json().dump(2)
  • {:k} — kind id only