Current section

Files

Jump to
ywt_core src ywt@internal@jose_json.erl
Raw

src/ywt@internal@jose_json.erl

-module(ywt@internal@jose_json).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/ywt/internal/jose_json.gleam").
-export([parse/2, parse_bits/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/ywt/internal/jose_json.gleam", 13).
?DOC(false).
-spec parse(binary(), gleam@dynamic@decode:decoder(ESD)) -> {ok, ESD} |
{error, gleam@json:decode_error()}.
parse(Input, Decoder) ->
gleam@result:'try'(
ywt_core_ffi:decode_json_to_dynamic(gleam_stdlib:identity(Input)),
fun(Dynamic_value) ->
_pipe = gleam@dynamic@decode:run(Dynamic_value, Decoder),
gleam@result:map_error(
_pipe,
fun(Field@0) -> {unable_to_decode, Field@0} end
)
end
).
-file("src/ywt/internal/jose_json.gleam", 25).
?DOC(false).
-spec parse_bits(bitstring(), gleam@dynamic@decode:decoder(ESH)) -> {ok, ESH} |
{error, gleam@json:decode_error()}.
parse_bits(Input, Decoder) ->
gleam@result:'try'(
ywt_core_ffi:decode_json_to_dynamic(Input),
fun(Dynamic_value) ->
_pipe = gleam@dynamic@decode:run(Dynamic_value, Decoder),
gleam@result:map_error(
_pipe,
fun(Field@0) -> {unable_to_decode, Field@0} end
)
end
).