gloml

Types

pub type DecodeError {
  InvalidTomlError(String)
  UnexpectedFormat(List(dyn.DecodeError))
}

Constructors

  • InvalidTomlError(String)
  • UnexpectedFormat(List(dyn.DecodeError))

Functions

pub fn decode(from toml_string: String, using decoder: fn(Dynamic) ->
    Result(a, List(DecodeError))) -> Result(a, gloml.DecodeError)

Parse a toml file with a decoder.

pub fn decode_toml() {
  let version =
    gloml.decode("
  [my-project]
  version = \"1.2.3\"
  ",
    d.field("my-project", d.field("version", d.string)),
  )
  should.equal(version, Ok("1.2.3"))
}
pub fn decode_dynamic(toml_string: String) -> Result(
  Dynamic,
  DecodeError,
)

Parse a toml file into a gleam/dynamic.Dynamic.

pub fn decode_toml() {
  let dynamic =
    gloml.decode("
  [my-project]
  version = \"1.2.3\"
  ")
}
Search Document