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

Module yaml/taglib

The taglib API enables you to define custom tags for the types you are using with the serialization API.

Imports

data

Consts

yTagNimChar = "tag:nimyaml.org,2016:system:char"
yTagNimFloat32 = "tag:nimyaml.org,2016:system:float32"
yTagNimFloat64 = "tag:nimyaml.org,2016:system:float64"
yTagNimInt8 = "tag:nimyaml.org,2016:system:int8"
yTagNimInt16 = "tag:nimyaml.org,2016:system:int16"
yTagNimInt32 = "tag:nimyaml.org,2016:system:int32"
yTagNimInt64 = "tag:nimyaml.org,2016:system:int64"
yTagNimUInt8 = "tag:nimyaml.org,2016:system:uint8"
yTagNimUInt16 = "tag:nimyaml.org,2016:system:uint16"
yTagNimUInt32 = "tag:nimyaml.org,2016:system:uint32"
yTagNimUInt64 = "tag:nimyaml.org,2016:system:uint64"

Procs

proc initNimYamlTagHandle(): seq[tuple[handle, uriPrefix: string]] {....raises: [],
    tags: [], forbids: [].}
returns a seq describing the tag handle !n! referencing the NimYAML tag namespace. Can be used with SerializationOptions.
proc nimTag(suffix: string): Tag {....raises: [], tags: [], forbids: [].}
prepends NimYAML's tag repository prefix to the given suffix. For example, nimTag("system:char") yields "tag:nimyaml.org,2016:system:char".
proc yamlTag(T`gensym1: typedesc[char]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym4: typedesc[int8]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym7: typedesc[int16]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym10: typedesc[int32]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym13: typedesc[int64]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym16: typedesc[uint8]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym19: typedesc[uint16]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym22: typedesc[uint32]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym25: typedesc[uint64]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym28: typedesc[float32]): Tag {.inline, ...raises: [].}
autogenerated
proc yamlTag(T`gensym31: typedesc[float64]): Tag {.inline, ...raises: [].}
autogenerated

Templates

template setTag(t: typedesc; tag: Tag)
Associate the given uri with a certain type. This uri is used as YAML tag when loading and dumping values of this type.
template setTag(t: typedesc; tag: Tag; idName: untyped)
Like setTagUri, but lets you choose a symbol for the TagId of the uri. This is only necessary if you want to implement serialization / construction yourself.
template setTagUri(t: typedesc; uri: string) {....deprecated: "use setTag".}
template setTagUri(t: typedesc; uri: string; idName: untyped) {.
    ...deprecated: "use setTag".}