Current section
Files
Jump to
Current section
Files
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]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/utils/misc.gleam", 5).
?DOC(" For when you really know the Result cannot be Error\n").
-spec unwrap({ok, FYZ} | {error, any()}) -> FYZ.
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.
-file("src/utils/misc.gleam", 12).
-spec to_hex(bitstring()) -> binary().
to_hex(Buf) ->
_pipe = Buf,
_pipe@1 = gleam_stdlib:base16_encode(_pipe),
string:lowercase(_pipe@1).