Esc

Receive_Kind

enumextensionsince 0.36.1Source
  • macOS: Receive_Kind works on macOS
  • Linux: Receive_Kind works on Linux
  • Windows: Receive_Kind works on Windows
  • Wasm: Receive_Kind works on Wasm

Declaration

Receive_Kind :: enum u8 {
    MESSAGE;    END;    ERROR;}

MESSAGE carries one owned message. On clients, END and ERROR still require finish to obtain the authoritative RPC status.

Example
channel: Channel; // set transport.base_url and transport.tls before the first call
method := Method.{ path = "/echo.Echo/Say" };
call, status := open_call(*channel, method);
assert(status.code == .OK);
defer close(*call);
message, kind := receive_bytes(*call);
if kind == .MESSAGE free(message.data);
final := finish(*call); // the authoritative result, also after .END or .ERROR
defer free_status(*final);

See also