Add integer converter
This commit is contained in:
parent
8d48ae60e9
commit
ea698bedcc
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20240312"
|
version = "20240422"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -335,6 +335,9 @@ template unpreservable*() {.pragma.}
|
||||||
## as its native type.
|
## as its native type.
|
||||||
## Unpreservability is asserted at runtime.
|
## Unpreservability is asserted at runtime.
|
||||||
|
|
||||||
|
converter preserve*(i: SomeInteger): Value =
|
||||||
|
Value(kind: pkRegister, register: BiggestInt i)
|
||||||
|
|
||||||
proc toPreserves*[T](x: T): Value {.gcsafe.} =
|
proc toPreserves*[T](x: T): Value {.gcsafe.} =
|
||||||
## Serializes ``x`` to Preserves. Can be customized by defining
|
## Serializes ``x`` to Preserves. Can be customized by defining
|
||||||
## ``toPreservesHook(x: T; E: typedesc)`` in the calling scope.
|
## ``toPreservesHook(x: T; E: typedesc)`` in the calling scope.
|
||||||
|
|
Loading…
Reference in New Issue