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 Enum

RedirectBehavior

Public Enum
std.http.Client.Request.RedirectBehavior
pub const RedirectBehavior = enum(u16)

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

Functions

pub fn init(n: u16) RedirectBehavior
pub fn subtractOne(rb: *RedirectBehavior) void
pub fn remaining(rb: RedirectBehavior) u16

File

http/Client.zig:857
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
    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 init(n: u16) RedirectBehavior {
            assert(n != std.math.maxInt(u16));
            return @fromBackingInt(@intCast(n));
        }

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

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