Zig 0.17.0-dev (Split by item)

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 library itself.

testReadError

Client.testReadError
fn testReadError(input_buf: []const u8, tls_version: tls.ProtocolVersion, cipher: tls.ApplicationCipher) ReadError

File

lib/std/crypto/tls/Client.zig:1679

Code

fn testReadError(input_buf: []const u8, tls_version: tls.ProtocolVersion, cipher: tls.ApplicationCipher) ReadError {
    var input_reader: Reader = .fixed(input_buf);
    var read_buf: [tls.max_ciphertext_record_len]u8 = undefined;
    var c: Client = .{
        .input = &input_reader,
        .reader = .{
            .buffer = &read_buf,
            .vtable = &.{ .stream = stream, .readVec = readVec },
            .seek = 0,
            .end = 0,
        },
        .output = undefined,
        .writer = undefined,
        .tls_version = tls_version,
        .read_seq = 0,
        .write_seq = 0,
        .received_close_notify = false,
        .allow_truncation_attacks = false,
        .application_cipher = cipher,
        .ssl_key_log = null,
    };
    var w: Writer = .failing;
    std.testing.expectError(error.ReadFailed, c.reader.stream(&w, .unlimited)) catch
        @panic("expected ReadFailed");
    return c.read_err.?;
}