enumstd.http.Client.Request.RedirectBehavior[src]

Any value other than not_allowed or unhandled means that integer represents how many remaining redirects are allowed.

Fields

not_allowed = 0

The next redirect will cause an error.

unhandled = std.math.maxInt(u16)

Redirects are passed to the client to analyze the redirect response directly.

_

Functions

FunctionsubtractOne[src]

pub fn subtractOne(rb: *RedirectBehavior) void

Parameters

Source Code

Source code
pub fn subtractOne(rb: *RedirectBehavior) void {
    switch (rb.*) {
        .not_allowed => unreachable,
        .unhandled => unreachable,
        _ => rb.* = @enumFromInt(@intFromEnum(rb.*) - 1),
    }
}

Functionremaining[src]

pub fn remaining(rb: RedirectBehavior) u16

Parameters

Source Code

Source code
pub fn remaining(rb: RedirectBehavior) u16 {
    assert(rb != .unhandled);
    return @intFromEnum(rb);
}

Source Code

Source code
pub const RedirectBehavior = enum(u16) {
    /// The next redirect will cause an error.
    not_allowed = 0,
    /// Redirects are passed to the client to analyze the redirect response
    /// directly.
    unhandled = std.math.maxInt(u16),
    _,

    pub fn subtractOne(rb: *RedirectBehavior) void {
        switch (rb.*) {
            .not_allowed => unreachable,
            .unhandled => unreachable,
            _ => rb.* = @enumFromInt(@intFromEnum(rb.*) - 1),
        }
    }

    pub fn remaining(rb: RedirectBehavior) u16 {
        assert(rb != .unhandled);
        return @intFromEnum(rb);
    }
}