Current section

Files

Jump to
argamak src argamak@format.erl
Raw

src/argamak@format.erl

-module(argamak@format).
-compile(no_auto_import).
-export([float32/0, int32/0, float64/0, int64/0, uint64/0, uint32/0, bfloat16/0, float16/0, int16/0, uint16/0, int8/0, uint8/0, to_native/1, to_string/1]).
-export_type([format/1, float32/0, int32/0, float64/0, int64/0, uint64/0, uint32/0, bfloat16/0, float16/0, int16/0, uint16/0, int8/0, uint8/0, native/0]).
-opaque format(JJG) :: {format, JJG}.
-type float32() :: float32.
-type int32() :: int32.
-type float64() :: float64.
-type int64() :: int64.
-type uint64() :: uint64.
-type uint32() :: uint32.
-type bfloat16() :: bfloat16.
-type float16() :: float16.
-type int16() :: int16.
-type uint16() :: uint16.
-type int8() :: int8.
-type uint8() :: uint8.
-type native() :: any().
-spec float32() -> format(float32()).
float32() ->
{format, float32}.
-spec int32() -> format(int32()).
int32() ->
{format, int32}.
-spec float64() -> format(float64()).
float64() ->
{format, float64}.
-spec int64() -> format(int64()).
int64() ->
{format, int64}.
-spec uint64() -> format(uint64()).
uint64() ->
{format, uint64}.
-spec uint32() -> format(uint32()).
uint32() ->
{format, uint32}.
-spec bfloat16() -> format(bfloat16()).
bfloat16() ->
{format, bfloat16}.
-spec float16() -> format(float16()).
float16() ->
{format, float16}.
-spec int16() -> format(int16()).
int16() ->
{format, int16}.
-spec uint16() -> format(uint16()).
uint16() ->
{format, uint16}.
-spec int8() -> format(int8()).
int8() ->
{format, int8}.
-spec uint8() -> format(uint8()).
uint8() ->
{format, uint8}.
-spec to_native(format(any())) -> native().
to_native(Format) ->
{format, X} = Format,
argamak_ffi:format_to_native(X).
-spec to_string(format(any())) -> binary().
to_string(Format) ->
gleam@string:inspect(Format).