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 standard library.
std › crypto › codecs › asn1 › Tag › fromZig Public Function fromZig Doc Source Public Function std.crypto.codecs.asn1.Tag.fromZig
pub fn fromZig (comptime T : type ) Tag Params File crypto/codecs/asn1.zig: 151
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171 pub fn fromZig (comptime T : type ) Tag {
switch (@typeInfo (T )) {
.@"struct" , .@"enum" , .@"union" => {
if (@hasDecl (T , "asn1_tag" )) return T .asn1_tag ;
},
else => {},
}
switch (@typeInfo (T )) {
.@"struct" , .@"union" => return universal (.sequence , true ),
.bool => return universal (.boolean , false ),
.int => return universal (.integer , false ),
.@"enum" => |e | {
if (@hasDecl (T , "oids" )) return Oid .asn1_tag ;
return universal (if (e .mode == .exhaustive ) .enumerated else .integer , false );
},
.optional => |o | return fromZig (o .child ),
.null => return universal (.null , false ),
else => @compileError ("cannot map Zig type to asn1_tag " ++ @typeName (T )),
}
}