Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/grpc/client/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule GRPC.Client.Adapter do

@callback disconnect(channel :: Channel.t()) :: {:ok, Channel.t()} | {:error, any()}

@callback send_request(stream :: Stream.t(), contents :: binary(), opts :: keyword()) ::
@callback send_request(stream :: Stream.t(), contents :: iodata(), opts :: keyword()) ::
Stream.t()

@doc """
Expand All @@ -36,7 +36,7 @@ defmodule GRPC.Client.Adapter do
Opts:
- :send_end_stream (optional) - ends the request stream
"""
@callback send_data(stream :: Stream.t(), message :: binary(), opts :: keyword()) :: Stream.t()
@callback send_data(stream :: Stream.t(), message :: iodata(), opts :: keyword()) :: Stream.t()

@doc """
Similarly to the option sent on `send_data/2` - :send_end_stream -
Expand Down
2 changes: 1 addition & 1 deletion lib/grpc/codec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule GRPC.Codec do

@doc ~s(Name is identity of the codec, which will be suffix after content-type "application/grpc+" such as "proto".)
@callback name() :: String.t()
@callback encode(any) :: binary
@callback encode(any) :: iodata()
@callback decode(any, module :: atom) :: any

@doc """
Expand Down
4 changes: 2 additions & 2 deletions lib/grpc/codec/proto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ defmodule GRPC.Codec.Proto do
"proto"
end

def encode(%mod{} = struct) do
mod.encode(struct)
def encode(struct) do
Protobuf.Encoder.encode_to_iodata(struct)
end

def decode(binary, module) do
Expand Down
2 changes: 1 addition & 1 deletion lib/grpc/compressor.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule GRPC.Compressor do
@callback name() :: String.t()
@callback compress(binary) :: binary
@callback compress(iodata()) :: binary
@callback decompress(binary) :: binary
end