Packages

Various modules and helpers for working with Nimiq primitives in the Gleam programming language or as a CLI

Current section

Files

Jump to
nimiq_gleam src utils@misc.erl
Raw

src/utils@misc.erl

-module(utils@misc).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([unwrap/1, to_hex/1]).
-spec unwrap({ok, IBY} | {error, any()}) -> IBY.
unwrap(Res) ->
case Res of
{ok, A} ->
A;
{error, _} ->
erlang:error(#{gleam_error => panic,
message => <<"Called unwrap on an Error value"/utf8>>,
module => <<"utils/misc"/utf8>>,
function => <<"unwrap"/utf8>>,
line => 8})
end.
-spec to_hex(bitstring()) -> binary().
to_hex(Buf) ->
_pipe = Buf,
_pipe@1 = binary:encode_hex(_pipe),
gleam@string:lowercase(_pipe@1).