status-im / nim-toml-serialization

Flexible TOML serialization [not] relying on run-time type information.
Apache License 2.0
36 stars 7 forks source link

Compile-time Support #46

Closed Patitotective closed 2 years ago

Patitotective commented 2 years ago

Right now if you try to load (or decode) a TOML file at compile time (using the {.compileTime} pragma or const) you get an error.
I am using TOML for a configuration file and it's important that I can read it at compile time. Not sure if this is possible or if there is a workaround. Thanks

import toml_serialization

let data {.compileTime.} = Toml.loadFile("data.toml", TomlValueRef)
/home/me/.nimble/pkgs/faststreams-0.3.0/faststreams/inputs.nim(247, 26) Error: cannot evaluate at compile time: memFileInputVTable

Version 0.2.1.