mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
docs: docgen supports release safe exe code examples
and make the type names of `@hasDecl` and `@hasField` consistent
This commit is contained in:
parent
ffaf37a7e7
commit
0e9f86b1db
@ -528,6 +528,8 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
|
||||
const end_tag_name = tokenizer.buffer[end_code_tag.start..end_code_tag.end];
|
||||
if (mem.eql(u8, end_tag_name, "code_release_fast")) {
|
||||
mode = builtin.Mode.ReleaseFast;
|
||||
} else if (mem.eql(u8, end_tag_name, "code_release_safe")) {
|
||||
mode = builtin.Mode.ReleaseSafe;
|
||||
} else if (mem.eql(u8, end_tag_name, "code_link_object")) {
|
||||
_ = try eatToken(tokenizer, Token.Id.Separator);
|
||||
const obj_tok = try eatToken(tokenizer, Token.Id.TagContent);
|
||||
|
||||
@ -7137,7 +7137,7 @@ fn func() void {
|
||||
{#header_close#}
|
||||
|
||||
{#header_open|@hasDecl#}
|
||||
<pre>{#syntax#}@hasDecl(comptime container: type, comptime name: []const u8) bool{#endsyntax#}</pre>
|
||||
<pre>{#syntax#}@hasDecl(comptime Container: type, comptime name: []const u8) bool{#endsyntax#}</pre>
|
||||
<p>
|
||||
Returns whether or not a {#link|struct#}, {#link|enum#}, or {#link|union#} has a declaration
|
||||
matching {#syntax#}name{#endsyntax#}.
|
||||
@ -7170,7 +7170,7 @@ test "@hasDecl" {
|
||||
{#header_close#}
|
||||
|
||||
{#header_open|@hasField#}
|
||||
<pre>{#syntax#}@hasField(comptime T: type, comptime name: []const u8) bool{#endsyntax#}</pre>
|
||||
<pre>{#syntax#}@hasField(comptime Container: type, comptime name: []const u8) bool{#endsyntax#}</pre>
|
||||
<p>Returns whether the field name of a struct, union, or enum exists.</p>
|
||||
<p>
|
||||
The result is a compile time constant.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user