[][src]Module shoebill::ron

Types for formatting items using Rust Object Notation (the format you see when you debug format Rust items with the {:#?} formatter).

They all have the same API, which is new(), add_name() (which adds a path segment), add_field(), to_doc() and render() which is a shortcut that includes a call to to_doc().

They're written in such a way that they remain generic over anything that can be converted into StrOrDoc, and you only need to give them the Printer object once, when they're being finished and/or rendered.

The big thing that needs to be done on top of this is to make a new enum that recognizes other Ron objects and can format accordingly; IE you want tuples to group() their elements, UNLESS they're RonStruct mappings, etc.

Structs

RonOption

Formats some Option

RonResult

Formats some Result<A, E> where both A and E implement Into<StrOrDoc<'p>>

RonSequence

A sequence (slice, array, vec, etc)

RonStruct

A Rust struct or mapping

RonTuple

A tuple (also tuple structs and enums). A RonTuple with a name but no fields will be interpreted as a nullary tuple struct/enum, so printed as just the path-segments comprising the name. A nameless tuple with no fields will still be printed as ().