public extension PureYAML.Emitting { /// Formatting choices for emitted YAML. struct Options: Equatable, Sendable { public static let `default` = Options() public var scalarStyle: ScalarStyle public var collectionStyle: CollectionStyle /// Spaces per nesting level in block style. Has no effect on flow /// style, which has no indentation to control. Must be at least 1: /// block YAML distinguishes nesting only by indentation, so 0 would /// make sibling and child content indistinguishable and produce /// output that cannot round-trip back through the parser. Not /// enforced at construction (a plain `Int`, matching this struct's /// existing options), so passing 0 or negative is a caller error /// that surfaces as unparseable output, not a thrown error. public var indentWidth: Int /// Sort mapping keys lexicographically by their rendered (already /// quoted/escaped) form before emitting, instead of preserving /// `Model.Mapping`'s insertion order. Off by default: insertion /// order is what makes round-tripping a duplicate-key-preserving /// `Mapping` back to itself meaningful, so sorting is opt-in, not /// the default. public var sortKeys: Bool /// Emit the YAML-specification canonical form: an explicit `---` /// document start, an explicit `!!tag` on every node, double-quoted /// scalars, and flow collections with one `? key : value,` entry /// per line. When set, `scalarStyle`, `collectionStyle`, and /// `lineWidth` are ignored; `indentWidth` and `sortKeys` still /// apply. Off by default. public var canonical: Bool /// Emit an explicit `---` document start marker. Implied by /// `canonical`. Off by default. public var explicitDocumentStart: Bool /// Emit an explicit `...` document end marker. Off by default. public var explicitDocumentEnd: Bool /// The preferred maximum line width. `0` (the default) disables /// wrapping. When positive, a flow collection whose single-line /// form would overflow the width re-renders with one entry per /// line, and a plain block scalar folds at spaces onto /// more-indented continuation lines; folding restores each break /// to the same single space on reparse, so the value is unchanged. /// Content with no legal break point (a single overlong word, a /// quoted or block scalar) stays on one line. public var lineWidth: Int public init( scalarStyle: ScalarStyle = .quoted, collectionStyle: CollectionStyle = .block, indentWidth: Int = 2, sortKeys: Bool = false, canonical: Bool = false, explicitDocumentStart: Bool = false, explicitDocumentEnd: Bool = false, lineWidth: Int = 0, ) { self.scalarStyle = scalarStyle self.collectionStyle = collectionStyle self.indentWidth = indentWidth self.sortKeys = sortKeys self.canonical = canonical self.explicitDocumentStart = explicitDocumentStart self.explicitDocumentEnd = explicitDocumentEnd self.lineWidth = lineWidth } } }