From 02b61224b234b017cd2397ee6e8936c220b959f5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 31 Jan 2018 20:56:53 -0500 Subject: [PATCH] add docs for memberType, memberCount, memberName --- doc/langref.html.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 30a1fe36f794cb22320edd4d09352075f71a216f..29a40c86a51823e8c66d302eb51f30331225a3bc 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4217,17 +4217,28 @@ fn add(a: i32, b: i32) i32 { return a + b; } {#header_open|@memberCount#}
@memberCount(comptime T: type) -> (number literal)

- This function returns the number of enum values in an enum type. + This function returns the number of members in a struct, enum, or union type.

The result is a compile time constant.

+

+ It does not include functions, variables, or constants. +

{#header_close#} {#header_open|@memberName#} -

TODO

+
@memberName(comptime T: type, comptime index: usize) -> [N]u8
+

Returns the field name of a struct, union, or enum.

+

+ The result is a compile time constant. +

+

+ It does not include functions, variables, or constants. +

{#header_close#} {#header_open|@memberType#} -

TODO

+
@memberType(comptime T: type, comptime index: usize) -> type
+

Returns the field type of a struct or union.

{#header_close#} {#header_open|@memcpy#}
@memcpy(noalias dest: &u8, noalias source: &const u8, byte_count: usize)
@@ -5856,7 +5867,7 @@ hljs.registerLanguage("zig", function(t) { a = t.IR + "\\s*\\(", c = { keyword: "const align var extern stdcallcc nakedcc volatile export pub noalias inline struct packed enum union break return try catch test continue unreachable comptime and or asm defer errdefer if else switch while for fn use bool f32 f64 void type noreturn error i8 u8 i16 u16 i32 u32 i64 u64 isize usize i8w u8w i16w i32w u32w i64w u64w isizew usizew c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong", - built_in: "breakpoint returnAddress frameAddress fieldParentPtr setFloatMode IntType OpaqueType compileError compileLog setCold setRuntimeSafety setEvalBranchQuota offsetOf memcpy inlineCall setGlobalLinkage setGlobalSection divTrunc divFloor enumTagName intToPtr ptrToInt panic canImplicitCast ptrCast bitCast rem mod memset sizeOf alignOf alignCast maxValue minValue memberCount typeOf addWithOverflow subWithOverflow mulWithOverflow shlWithOverflow shlExact shrExact cInclude cDefine cUndef ctz clz import cImport errorName embedFile cmpxchg fence divExact truncate", + built_in: "breakpoint returnAddress frameAddress fieldParentPtr setFloatMode IntType OpaqueType compileError compileLog setCold setRuntimeSafety setEvalBranchQuota offsetOf memcpy inlineCall setGlobalLinkage setGlobalSection divTrunc divFloor enumTagName intToPtr ptrToInt panic canImplicitCast ptrCast bitCast rem mod memset sizeOf alignOf alignCast maxValue minValue memberCount memberName memberType typeOf addWithOverflow subWithOverflow mulWithOverflow shlWithOverflow shlExact shrExact cInclude cDefine cUndef ctz clz import cImport errorName embedFile cmpxchg fence divExact truncate", literal: "true false null undefined" }, n = [e, t.CLCM, t.CBCM, s, r]; -- 2.54.0