NimYAML Home Testing Ground Docs: Overview Serialization Modules NimYAML 2.x Source on GitHub

Module yaml/dumping

The dumping API enables you to dump native Nim values as YAML character stream. Along with the loading API, this forms the highest-level API of NimYAML.

Imports

parser, presenter, native, internal

Types

Dumper = object
  presentation*: PresentationOptions
  serialization*: SerializationOptions
Holds configuration for dumping Nim values.

Procs

proc blockOnlyDumper(): Dumper {....raises: [], tags: [], forbids: [].}
proc canonicalDumper(): Dumper {....raises: [], tags: [], forbids: [].}
proc dump[K](dumper: Dumper; value: K): string {.hint[XCannotRaiseY]: false, ...raises: [
    YamlPresenterJsonError, YamlPresenterOutputError, YamlSerializationError].}
Dump a Nim value as YAML into a string.
proc dump[K](dumper: Dumper; value: K; target: Stream) {....raises: [
    YamlPresenterJsonError, YamlPresenterOutputError, YamlSerializationError].}
Dump a Nim value as YAML into the given stream.
proc jsonDumper(): Dumper {....raises: [], tags: [], forbids: [].}
proc minimalDumper(): Dumper {....raises: [], tags: [], forbids: [].}
proc setBlockOnlyStyle(dumper: var Dumper) {....raises: [], tags: [], forbids: [].}
Output preset. Uses block style exclusively.
proc setCanonicalStyle(dumper: var Dumper) {....raises: [], tags: [], forbids: [].}
Output preset. Generates specific tags for all nodes, uses flow style, quotes all string scalars.
proc setDefaultStyle(dumper: var Dumper) {....raises: [], tags: [], forbids: [].}
Output preset. Uses block style by default, but flow style for collections that only contain scalar values.
proc setJsonStyle(dumper: var Dumper) {....raises: [], tags: [], forbids: [].}
Output preset. Uses flow style, omits tags, anchors and all other non-JSON entities, formats all scalars as corresponding JSON values.
proc setMinimalStyle(dumper: var Dumper) {....raises: [], tags: [], forbids: [].}
Output preset. Tries to output single line flow-only output.
proc transform(dumper: Dumper; input: Stream | string;
               resolveToCoreYamlTags: bool = false): string {....raises: [IOError,
    OSError, YamlParserError, YamlPresenterJsonError, YamlPresenterOutputError].}
Parse input as YAML character stream and then dump it using the given presentation options. Returns the resulting string. If resolveToCoreYamlTags is true, non-specific tags will be replaced by specific tags according to the YAML core schema.
proc transform(dumper: Dumper; input: Stream | string; output: Stream;
               resolveToCoreYamlTags: bool = false) {....raises: [IOError, OSError,
    YamlParserError, YamlPresenterJsonError, YamlPresenterOutputError].}
Parse input as YAML character stream and then dump it to output using the given presentation options. If resolveToCoreYamlTags is true, non-specific tags will be replaced by specific tags according to the YAML core schema.

Exports

YamlStreamError, endMapEvent, hash, constructObject, startSeqEvent, defineCoreTag, ignore, collectionStyle, yamlTag, construct, yTagExclamationMark, peek=, yTagValue, yTagNull, constructObject, yamlTag, CollectionStyle, EventKind, hash, representObject, YamlStream, constructChild, startSeqEvent, yTagInteger, constructObject, constructionError, yTagSet, representChild, constructObjectDefault, endDocEvent, yTagMapping, implicit, startStreamEvent, ScalarStyle, constructObject, ==, presentTag, representObject, SerializationOptions, constructObject, nimyamlTagRepositoryPrefix, Anchor, representChild, newYamlConstructionError, defineTag, representObject, constructObject, YamlLoadingError, defaultVal, Event, constructChild, constructObject, yamlTag, endStreamEvent, peek, $, constructObjectDefault, representObject, representObject, Mark, transient, representObject, yTagYaml, constructObject, newBufferYamlStream, $, ConstructionContext, TagStyle, ==, scalarEvent, yamlTagRepositoryPrefix, constructScalarItem, yTagQuestionMark, constructObject, representChild, constructObject, representObject, representObject, yTagBoolean, put, hasSpecificTag, constructChild, getLastTokenContext, yamlTag, ==, representObject, yTagPairs, constructObject, yamlTag, yTagOrderedMap, representChild, Tag, Properties, mitems, aliasEvent, yamlTag, representObject, emptyProperties, put, startDocEvent, startMapEvent, constructChild, constructObject, basicInit, $, scalarEvent, endSeqEvent, initConstructionContext, startMapEvent, yTagNimField, initYamlStream, constructObject, next, yTagFloat, constructObject, yamlTag, constructChild, renderAttrs, YamlSerializationError, AnchorStyle, BufferYamlStream, representChild, yamlTag, yTagString, yamlTag, constructChild, represent, yTagSequence, yTagBinary, representObject, yTagMerge, sparse, constructObject, representObject, constructObject, SerializationContext, representChild, representObject, yAnchorNone, yamlTag, properties, initSerializationContext, representObject, YamlConstructionError, items, yamlTag, representObject, yTagTimestamp, representObject