Options

public struct Options

Configuration options to use when emitting YAML.

  • Set if the output should be in the “canonical” format described in the YAML specification.

    Declaration

    Swift

    public var canonical: Bool
  • Set the indentation value.

    Declaration

    Swift

    public var indent: Int
  • Set the preferred line width. -1 means unlimited.

    Declaration

    Swift

    public var width: Int
  • Set if unescaped non-ASCII characters are allowed.

    Declaration

    Swift

    public var allowUnicode: Bool
  • Set the preferred line break.

    Declaration

    Swift

    public var lineBreak: LineBreak
  • Set to emit an explicit document start marker.

    Declaration

    Swift

    public var explicitStart: Bool
  • Set to emit an explicit document end marker.

    Declaration

    Swift

    public var explicitEnd: Bool
  • The %YAML directive value or nil.

    Declaration

    Swift

    public var version: (major: Int, minor: Int)?
  • Set if emitter should sort keys in lexicographic order.

    Declaration

    Swift

    public var sortKeys: Bool
  • Set the style for sequences (arrays / lists)

    Declaration

    Swift

    public var sequenceStyle: Node.Sequence.Style
  • Set the style for mappings (dictionaries)

    Declaration

    Swift

    public var mappingStyle: Node.Mapping.Style
  • Set the style for scalars that include newlines

    Declaration

    Swift

    public var newLineScalarStyle: Node.Scalar.Style
  • Redundancy aliasing strategy to use when encoding. Defaults to nil

    Declaration

    Swift

    public var redundancyAliasingStrategy: RedundancyAliasingStrategy?
  • Create Emitter.Options with the specified values.

    Declaration

    Swift

    public init(canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false,
                lineBreak: Emitter.LineBreak = .ln,
                explicitStart: Bool = false,
                explicitEnd: Bool = false,
                version: (major: Int, minor: Int)? = nil,
                sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any,
                mappingStyle: Node.Mapping.Style = .any,
                newLineScalarStyle: Node.Scalar.Style = .any,
                redundancyAliasingStrategy: RedundancyAliasingStrategy? = nil)

    Parameters

    canonical

    Set if the output should be in the “canonical” format described in the YAML specification.

    indent

    Set the indentation value.

    width

    Set the preferred line width. -1 means unlimited.

    allowUnicode

    Set if unescaped non-ASCII characters are allowed.

    lineBreak

    Set the preferred line break.

    explicitStart

    Explicit document start ---.

    explicitEnd

    Explicit document end ....

    version

    The %YAML directive value or nil.

    sortKeys

    Set if emitter should sort keys in lexicographic order.

    sequenceStyle

    Set the style for sequences (arrays / lists)

    mappingStyle

    Set the style for mappings (dictionaries)

    newLineScalarStyle

    Set the style for newline-containing scalars

    redundancyAliasingStrategy

    Set the strategy for identifying redundant structures and automatically aliasing them