trevrpc/handler

A server call, as its handler sees it. A handler runs in a process of its own, which alone can read and write the call; the server ends it when the call’s deadline passes, when the client cancels it, and on shutdown.

Types

pub type Call(request, response)

Values

pub fn datagrams_received(call: Call(request, response)) -> Int

How many of the requests read so far arrived as datagrams.

pub fn metadata(
  call: Call(request, response),
) -> dict.Dict(String, BitArray)

The request metadata.

pub fn method(call: Call(request, response)) -> String

The method’s path, /package.Service/Method.

pub fn recv(
  call: Call(request, response),
) -> Result(option.Option(request), status.Status)

Reads the next request of a client-streaming or bidirectional call: None once the client sent them all.

pub fn send(
  call: Call(request, response),
  response: response,
) -> Result(Nil, status.Status)

Sends a response of a server-streaming or bidirectional call, after the headers if they are waiting.

pub fn send_headers(
  call: Call(request, response),
  headers: dict.Dict(String, BitArray),
) -> Result(Nil, status.Status)

Sends the response headers at once, before any response.

pub fn set_trailers(
  call: Call(request, response),
  trailers: dict.Dict(String, BitArray),
) -> Nil

Sets the trailing metadata the call’s status carries.

✨ Search Document