Current section

Files

Jump to
liter_llm lib liter_llm decoded_data_url.ex
Raw

lib/liter_llm/decoded_data_url.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:8eac0267a7c84310b2cf7f8e6bc84b23de9f2dc29642b471b8bee9225f5c748a
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule LiterLlm.DecodedDataUrl do
@moduledoc """
Result of decoding a `data:` URL — MIME type and the decoded byte payload.
Named struct (rather than a tuple) so polyglot bindings can extract
`decode_data_url` with a typed return rather than a sanitized scalar.
"""
@typedoc "Result of decoding a `data:` URL — MIME type and the decoded byte payload."
@type t :: %__MODULE__{
mime: String.t() | nil,
data: binary()
}
defstruct mime: nil,
data: <<>>
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end