Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

receiveMessageWithMultiReader

Public Function
std.zig.Client.receiveMessageWithMultiReader
pub fn receiveMessageWithMultiReader(
    c: *Client,
    multi_reader: *Io.File.MultiReader,
    timeout: Io.Timeout,
) (Io.File.MultiReader.Error || Io.Timeout.Error)!InMessage.Header

Assumes that c.in is a reader in multi_reader. Guarantees that the response body will be buffered in c.in on success.

Params

  • c: *Client
  • multi_reader: *Io.File.MultiReader
  • timeout: Io.Timeout

File

zig/Client.zig:97
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
pub fn receiveMessageWithMultiReader(
    c: *Client,
    multi_reader: *Io.File.MultiReader,
    timeout: Io.Timeout,
) (Io.File.MultiReader.Error || Io.Timeout.Error)!InMessage.Header {
    while (c.in.bufferedLen() < @sizeOf(InMessage.Header)) {
        multi_reader.fill(64, timeout) catch |err| switch (err) {
            error.Canceled,
            error.Timeout,
            error.ConcurrencyUnavailable,
            error.EndOfStream,
            => |e| return e,
        };
    }
    const header = c.in.takeStruct(InMessage.Header, .little) catch unreachable;
    while (c.in.bufferedLen() < header.bytes_len) {
        try multi_reader.fill(header.bytes_len - c.in.bufferedLen(), timeout);
    }
    try multi_reader.checkAnyError();
    return header;
}