diff --git a/doc/langref.html.in b/doc/langref.html.in index 8e324743ea..78016e18db 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -10308,14 +10308,586 @@ fn readU32Be() u32 {} {#header_close#} {#header_open|Keyword Reference#} -
- TODO the rest of the keywords. Most of these can just be links to the relevant section. -
- {#header_open|Keyword: pub#} -The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the - declaration available to reference from a different file than the one it is declared in.
- {#see_also|@import#} - {#header_close#} +| + Keyword + | ++ Description + | +
|---|---|
+ {#syntax#}align{#endsyntax#}
+ |
+
+ {#syntax#}align{#endsyntax#} can be used to specify the alignment of a pointer.
+ It can also be used after a variable or function declaration to specify the alignment of pointers to that variable or function.
+
|
+
+ {#syntax#}allowzero{#endsyntax#}
+ |
+
+ The pointer attribute {#syntax#}allowzero{#endsyntax#} allows a pointer to have address zero.
+
|
+
+ {#syntax#}and{#endsyntax#}
+ |
+
+ The boolean operator {#syntax#}and{#endsyntax#}.
+
|
+
+ {#syntax#}anyframe{#endsyntax#}
+ |
+
+ {#syntax#}anyframe{#endsyntax#} can be used as a type for variables which hold pointers to function frames.
+
|
+
+ {#syntax#}anytype{#endsyntax#}
+ |
+
+ Function parameters and struct fields can be declared with {#syntax#}anytype{#endsyntax#} in place of the type.
+ The type will be inferred where the function is called or the struct is instantiated.
+
|
+
+ {#syntax#}asm{#endsyntax#}
+ |
+
+ {#syntax#}asm{#endsyntax#} begins an inline assembly expression. This allows for directly controlling the machine code generated on compilation.
+
|
+
+ {#syntax#}async{#endsyntax#}
+ |
+
+ {#syntax#}async{#endsyntax#} can be used before a function call to get a pointer to the function's frame when it suspends.
+
|
+
+ {#syntax#}await{#endsyntax#}
+ |
+
+ {#syntax#}await{#endsyntax#} can be used to suspend the current function until the frame provided after the {#syntax#}await{#endsyntax#} completes.
+ {#syntax#}await{#endsyntax#} copies the value returned from the target function's frame to the caller.
+
|
+
+ {#syntax#}break{#endsyntax#}
+ |
+
+ {#syntax#}break{#endsyntax#} can be used with a block label to return a value from the block.
+ It can also be used to exit a loop before iteration completes naturally.
+
|
+
+ {#syntax#}catch{#endsyntax#}
+ |
+
+ {#syntax#}catch{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to an error.
+ The expression after the {#syntax#}catch{#endsyntax#} can optionally capture the error value.
+
|
+
+ {#syntax#}comptime{#endsyntax#}
+ |
+
+ {#syntax#}comptime{#endsyntax#} before a declaration can be used to label variables or function parameters as known at compile time.
+ It can also be used to guarantee an expression is run at compile time.
+
|
+
+ {#syntax#}const{#endsyntax#}
+ |
+
+ {#syntax#}const{#endsyntax#} declares a variable that can not be modified.
+ Used as a pointer attribute, it denotes the value referenced by the pointer cannot be modified.
+
|
+
+ {#syntax#}continue{#endsyntax#}
+ |
+
+ {#syntax#}continue{#endsyntax#} can be used in a loop to jump back to the beginning of the loop.
+
|
+
+ {#syntax#}defer{#endsyntax#}
+ |
+
+ {#syntax#}defer{#endsyntax#} will execute an expression when control flow leaves the current block.
+
|
+
+ {#syntax#}else{#endsyntax#}
+ |
+
+ {#syntax#}else{#endsyntax#} can be used to provide an alternate branch for {#syntax#}if{#endsyntax#}, {#syntax#}switch{#endsyntax#},
+ {#syntax#}while{#endsyntax#}, and {#syntax#}for{#endsyntax#} expressions.
+
|
+
+ {#syntax#}enum{#endsyntax#}
+ |
+
+ {#syntax#}enum{#endsyntax#} defines an enum type.
+
|
+
+ {#syntax#}errdefer{#endsyntax#}
+ |
+
+ {#syntax#}errdefer{#endsyntax#} will execute an expression when control flow leaves the current block if the function returns an error.
+
|
+
+ {#syntax#}error{#endsyntax#}
+ |
+
+ {#syntax#}error{#endsyntax#} defines an error type.
+
|
+
+ {#syntax#}export{#endsyntax#}
+ |
+
+ {#syntax#}export{#endsyntax#} makes a function or variable externally visible in the generated object file.
+ Exported functions default to the C calling convention.
+
|
+
+ {#syntax#}extern{#endsyntax#}
+ |
+
+ {#syntax#}extern{#endsyntax#} can be used to declare a function or variable that will be resolved at link time, when linking statically
+ or at runtime, when linking dynamically.
+
|
+
+ {#syntax#}false{#endsyntax#}
+ |
+
+ The boolean value {#syntax#}false{#endsyntax#}.
+
|
+
+ {#syntax#}fn{#endsyntax#}
+ |
+
+ {#syntax#}fn{#endsyntax#} declares a function.
+
|
+
+ {#syntax#}for{#endsyntax#}
+ |
+
+ A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice, array, or tuple.
+
|
+
+ {#syntax#}if{#endsyntax#}
+ |
+
+ An {#syntax#}if{#endsyntax#} expression can test boolean expressions, optional values, or error unions.
+ For optional values or error unions, the if expression can capture the unwrapped value.
+
|
+
+ {#syntax#}inline{#endsyntax#}
+ |
+
+ {#syntax#}inline{#endsyntax#} can be used to label a loop expression such that it will be unrolled at compile time.
+ It can also be used to force a function to be inlined at all call sites.
+
|
+
+ {#syntax#}noalias{#endsyntax#}
+ |
+
+ The {#syntax#}noalias{#endsyntax#} keyword.
+
|
+
+ {#syntax#}nosuspend{#endsyntax#}
+ |
+
+ The {#syntax#}nosuspend{#endsyntax#} keyword.
+
|
+
+ {#syntax#}null{#endsyntax#}
+ |
+
+ The optional value {#syntax#}null{#endsyntax#}.
+
|
+
+ {#syntax#}or{#endsyntax#}
+ |
+
+ The boolean operator {#syntax#}or{#endsyntax#}.
+
|
+
+ {#syntax#}orelse{#endsyntax#}
+ |
+
+ {#syntax#}orelse{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to null.
+
|
+
+ {#syntax#}packed{#endsyntax#}
+ |
+
+ The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout
+ to the guaranteed {#syntax#}packed{#endsyntax#} layout.
+
|
+
+ {#syntax#}pub{#endsyntax#}
+ |
+
+ The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the declaration available
+ to reference from a different file than the one it is declared in.
+
|
+
+ {#syntax#}resume{#endsyntax#}
+ |
+
+ {#syntax#}resume{#endsyntax#} will continue execution of a function frame after the point the function was suspended.
+
|
+
+ {#syntax#}return{#endsyntax#}
+ |
+
+ {#syntax#}return{#endsyntax#} exits a function with a value.
+
|
+
+ {#syntax#}linksection{#endsyntax#}
+ |
+
+ The {#syntax#}linksection{#endsyntax#} keyword.
+
|
+
+ {#syntax#}struct{#endsyntax#}
+ |
+
+ {#syntax#}struct{#endsyntax#} defines a struct.
+
|
+
+ {#syntax#}suspend{#endsyntax#}
+ |
+
+ {#syntax#}suspend{#endsyntax#} will cause control flow to return to the call site or resumer of the function.
+ {#syntax#}suspend{#endsyntax#} can also be used before a block within a function,
+ to allow the function access to its frame before control flow returns to the call site.
+
|
+
+ {#syntax#}switch{#endsyntax#}
+ |
+
+ A {#syntax#}switch{#endsyntax#} expression can be used to test values of a common type.
+ {#syntax#}switch{#endsyntax#} cases can capture field values of a {#link|Tagged union#}.
+
|
+
+ {#syntax#}test{#endsyntax#}
+ |
+
+ The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code
+ used to make sure behavior meets expectations.
+
|
+
+ {#syntax#}threadlocal{#endsyntax#}
+ |
+
+ {#syntax#}threadlocal{#endsyntax#} can be used to specify a variable as thread-local.
+
|
+
+ {#syntax#}true{#endsyntax#}
+ |
+
+ The boolean value {#syntax#}true{#endsyntax#}.
+
|
+
+ {#syntax#}try{#endsyntax#}
+ |
+
+ {#syntax#}try{#endsyntax#} evaluates an error union expression.
+ If it is an error, it returns from the current function with the same error.
+ Otherwise, the expression results in the unwrapped value.
+
|
+
+ {#syntax#}undefined{#endsyntax#}
+ |
+
+ {#syntax#}undefined{#endsyntax#} can be used to leave a value uninitialized.
+
|
+
+ {#syntax#}union{#endsyntax#}
+ |
+
+ {#syntax#}union{#endsyntax#} defines a union.
+
|
+
+ {#syntax#}unreachable{#endsyntax#}
+ |
+
+ {#syntax#}unreachable{#endsyntax#} can be used to assert that control flow will never happen upon a particular location.
+ Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic.
+
|
+
+ {#syntax#}usingnamespace{#endsyntax#}
+ |
+
+ {#syntax#}usingnamespace{#endsyntax#} is a top-level declaration that imports all the public declarations of the operand,
+ which must be a struct, union, or enum, into the current scope.
+
|
+
+ {#syntax#}var{#endsyntax#}
+ |
+
+ {#syntax#}var{#endsyntax#} declares a variable that may be modified.
+
|
+
+ {#syntax#}volatile{#endsyntax#}
+ |
+
+ {#syntax#}volatile{#endsyntax#} can be used to denote loads or stores of a pointer have side effects.
+ It can also modify an inline assembly expression to denote it has side effects.
+
|
+
+ {#syntax#}while{#endsyntax#}
+ |
+
+ A {#syntax#}while{#endsyntax#} expression can be used to repeatedly test a boolean, optional, or error union expression,
+ and cease looping when that expression evaluates to false, null, or an error, respectively.
+
|
+