Add missing RDF.Serialization.Encoder and Decoder callback clauses

This were causing warning on formats defining overriding the
default implementation of encode!
This commit is contained in:
Marcel Otto 2021-11-23 00:44:33 +01:00
parent 601ebf54a0
commit 303aa7c8fa
2 changed files with 36 additions and 0 deletions

View file

@ -8,6 +8,14 @@ defmodule RDF.Serialization.Decoder do
@doc """
Decodes a serialized `RDF.Graph` or `RDF.Dataset` from a string.
It returns an `{:ok, data}` tuple, with `data` being the deserialized graph or
dataset, or `{:error, reason}` if an error occurs.
"""
@callback decode(String.t()) :: {:ok, Graph.t() | Dataset.t()} | {:error, any}
@doc """
Decodes a serialized `RDF.Graph` or `RDF.Dataset` from a string.
It returns an `{:ok, data}` tuple, with `data` being the deserialized graph or
dataset, or `{:error, reason}` if an error occurs.
"""
@ -18,6 +26,16 @@ defmodule RDF.Serialization.Decoder do
As opposed to `decode/2`, it raises an exception if an error occurs.
Note: The `__using__` macro automatically provides an overridable default
implementation based on the non-bang `decode` function.
"""
@callback decode!(String.t()) :: Graph.t() | Dataset.t()
@doc """
Decodes a serialized `RDF.Graph` or `RDF.Dataset` from a string.
As opposed to `decode/2`, it raises an exception if an error occurs.
Note: The `__using__` macro automatically provides an overridable default
implementation based on the non-bang `decode` function.
"""

View file

@ -6,6 +6,14 @@ defmodule RDF.Serialization.Encoder do
@doc """
Serializes a RDF data structure into a string.
It should return an `{:ok, string}` tuple, with `string` being the serialized
RDF data structure, or `{:error, reason}` if an error occurs.
"""
@callback encode(RDF.Data.t()) :: {:ok, String.t()} | {:error, any}
@doc """
Serializes a RDF data structure into a string.
It should return an `{:ok, string}` tuple, with `string` being the serialized
RDF data structure, or `{:error, reason}` if an error occurs.
"""
@ -16,6 +24,16 @@ defmodule RDF.Serialization.Encoder do
As opposed to `encode`, it raises an exception if an error occurs.
Note: The `__using__` macro automatically provides an overridable default
implementation based on the non-bang `encode` function.
"""
@callback encode!(RDF.Data.t()) :: String.t()
@doc """
Serializes a RDF data structure into a string.
As opposed to `encode`, it raises an exception if an error occurs.
Note: The `__using__` macro automatically provides an overridable default
implementation based on the non-bang `encode` function.
"""