authorgravatar for genericpb@gmail.comextrasharp <genericpb@gmail.com> 2020-08-24 13:12:23-05:00
committergravatar for genericpb@gmail.comextrasharp <genericpb@gmail.com> 2020-08-24 13:12:23-05:00
log4d1710c8993b6834bf17bf68fe8cb481c7a8aae9
tree9373f15092c6db846769e207294fdee3c9bac12e
parent7d6ed1cd854422613f0bf9dc8d54362dec4eca98

Make changes


1 files changed, 40 insertions(+), 24 deletions(-)

doc/langref.html.in+40-24
...@@ -10322,7 +10322,8 @@ fn readU32Be() u32 {}...@@ -10322,7 +10322,8 @@ fn readU32Be() u32 {}
10322 <pre>{#syntax#}align{#endsyntax#}</pre>10322 <pre>{#syntax#}align{#endsyntax#}</pre>
10323 </td>10323 </td>
10324 <td>10324 <td>
10325 {#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.10325 {#syntax#}align{#endsyntax#} can be used to specify the alignment of a pointer.
10326 It can also be used after a variable or function declaration to specify the alignment of pointers to that variable or function.
10326 <ul>10327 <ul>
10327 <li>See also {#link|Alignment#}</li>10328 <li>See also {#link|Alignment#}</li>
10328 </ul>10329 </ul>
...@@ -10366,7 +10367,8 @@ fn readU32Be() u32 {}...@@ -10366,7 +10367,8 @@ fn readU32Be() u32 {}
10366 <pre>{#syntax#}anytype{#endsyntax#}</pre>10367 <pre>{#syntax#}anytype{#endsyntax#}</pre>
10367 </td>10368 </td>
10368 <td>10369 <td>
10369 Function parameters can be declared with {#syntax#}anytype{#endsyntax#} in place of the type. The parameter type will be inferred where the function is called.10370 Function parameters and struct fields can be declared with {#syntax#}anytype{#endsyntax#} in place of the type.
10371 The type will be inferred where the function is called or the struct is instantiated.
10370 <ul>10372 <ul>
10371 <li>See also {#link|Function Parameter Type Inference#}</li>10373 <li>See also {#link|Function Parameter Type Inference#}</li>
10372 </ul>10374 </ul>
...@@ -10399,7 +10401,8 @@ fn readU32Be() u32 {}...@@ -10399,7 +10401,8 @@ fn readU32Be() u32 {}
10399 <pre>{#syntax#}await{#endsyntax#}</pre>10401 <pre>{#syntax#}await{#endsyntax#}</pre>
10400 </td>10402 </td>
10401 <td>10403 <td>
10402 {#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.10404 {#syntax#}await{#endsyntax#} can be used to suspend the current function until the frame provided after the {#syntax#}await{#endsyntax#} completes.
10405 {#syntax#}await{#endsyntax#} copies the value returned from the target function's frame to the caller.
10403 <ul>10406 <ul>
10404 <li>See also {#link|Async Functions#}</li>10407 <li>See also {#link|Async Functions#}</li>
10405 </ul>10408 </ul>
...@@ -10410,8 +10413,8 @@ fn readU32Be() u32 {}...@@ -10410,8 +10413,8 @@ fn readU32Be() u32 {}
10410 <pre>{#syntax#}break{#endsyntax#}</pre>10413 <pre>{#syntax#}break{#endsyntax#}</pre>
10411 </td>10414 </td>
10412 <td>10415 <td>
10413 {#syntax#}break{#endsyntax#} can be used to exit a loop before iteration completes naturally.10416 {#syntax#}break{#endsyntax#} can be used with a block label to return a value from the block.
10414 It can also be used with a block label to return a value from the block.10417 It can also be used to exit a loop before iteration completes naturally.
10415 <ul>10418 <ul>
10416 <li>See also {#link|blocks#}, {#link|while#}, {#link|for#}</li>10419 <li>See also {#link|blocks#}, {#link|while#}, {#link|for#}</li>
10417 </ul>10420 </ul>
...@@ -10422,7 +10425,8 @@ fn readU32Be() u32 {}...@@ -10422,7 +10425,8 @@ fn readU32Be() u32 {}
10422 <pre>{#syntax#}catch{#endsyntax#}</pre>10425 <pre>{#syntax#}catch{#endsyntax#}</pre>
10423 </td>10426 </td>
10424 <td>10427 <td>
10425 {#syntax#}catch{#endsyntax#} can be used to provide a default value for an error union, or capture its error value in an expression.10428 {#syntax#}catch{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to an error.
10429 The expression after the {#syntax#}catch{#endsyntax#} can optionally capture the error value.
10426 <ul>10430 <ul>
10427 <li>See also {#link|catch#}, {#link|Operators#}</li>10431 <li>See also {#link|catch#}, {#link|Operators#}</li>
10428 </ul>10432 </ul>
...@@ -10446,6 +10450,7 @@ fn readU32Be() u32 {}...@@ -10446,6 +10450,7 @@ fn readU32Be() u32 {}
10446 </td>10450 </td>
10447 <td>10451 <td>
10448 {#syntax#}const{#endsyntax#} declares a variable that can not be modified.10452 {#syntax#}const{#endsyntax#} declares a variable that can not be modified.
10453 Used as a pointer attribute, it denotes the value referenced by the pointer cannot be modified.
10449 <ul>10454 <ul>
10450 <li>See also {#link|Variables#}</li>10455 <li>See also {#link|Variables#}</li>
10451 </ul>10456 </ul>
...@@ -10467,7 +10472,7 @@ fn readU32Be() u32 {}...@@ -10467,7 +10472,7 @@ fn readU32Be() u32 {}
10467 <pre>{#syntax#}defer{#endsyntax#}</pre>10472 <pre>{#syntax#}defer{#endsyntax#}</pre>
10468 </td>10473 </td>
10469 <td>10474 <td>
10470 {#syntax#}defer{#endsyntax#} will execute an expression at the end of the current block.10475 {#syntax#}defer{#endsyntax#} will execute an expression when control flow leaves the current block.
10471 <ul>10476 <ul>
10472 <li>See also {#link|defer#}</li>10477 <li>See also {#link|defer#}</li>
10473 </ul>10478 </ul>
...@@ -10478,7 +10483,8 @@ fn readU32Be() u32 {}...@@ -10478,7 +10483,8 @@ fn readU32Be() u32 {}
10478 <pre>{#syntax#}else{#endsyntax#}</pre>10483 <pre>{#syntax#}else{#endsyntax#}</pre>
10479 </td>10484 </td>
10480 <td>10485 <td>
10481 {#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.10486 {#syntax#}else{#endsyntax#} can be used to provide an alternate branch for {#syntax#}if{#endsyntax#}, {#syntax#}switch{#endsyntax#},
10487 {#syntax#}while{#endsyntax#}, and {#syntax#}for{#endsyntax#} expressions.
10482 <ul>10488 <ul>
10483 <li>If used after an if expression, the else branch will be executed if the test value returns false, null, or an error.</li>10489 <li>If used after an if expression, the else branch will be executed if the test value returns false, null, or an error.</li>
10484 <li>If used within a switch expression, the else branch will be executed if the test value matches no other cases.</li>10490 <li>If used within a switch expression, the else branch will be executed if the test value matches no other cases.</li>
...@@ -10492,7 +10498,7 @@ fn readU32Be() u32 {}...@@ -10492,7 +10498,7 @@ fn readU32Be() u32 {}
10492 <pre>{#syntax#}enum{#endsyntax#}</pre>10498 <pre>{#syntax#}enum{#endsyntax#}</pre>
10493 </td>10499 </td>
10494 <td>10500 <td>
10495 {#syntax#}enum{#endsyntax#} defines an anonymous enum type.10501 {#syntax#}enum{#endsyntax#} defines an enum type.
10496 <ul>10502 <ul>
10497 <li>See also {#link|enum#}</li>10503 <li>See also {#link|enum#}</li>
10498 </ul>10504 </ul>
...@@ -10503,7 +10509,7 @@ fn readU32Be() u32 {}...@@ -10503,7 +10509,7 @@ fn readU32Be() u32 {}
10503 <pre>{#syntax#}errdefer{#endsyntax#}</pre>10509 <pre>{#syntax#}errdefer{#endsyntax#}</pre>
10504 </td>10510 </td>
10505 <td>10511 <td>
10506 {#syntax#}errdefer{#endsyntax#} will execute an expression at the end of the current block if and only if the block returns an error.10512 {#syntax#}errdefer{#endsyntax#} will execute an expression when control flow leaves the current block if the function returns an error.
10507 <ul>10513 <ul>
10508 <li>See also {#link|errdefer#}</li>10514 <li>See also {#link|errdefer#}</li>
10509 </ul>10515 </ul>
...@@ -10514,7 +10520,7 @@ fn readU32Be() u32 {}...@@ -10514,7 +10520,7 @@ fn readU32Be() u32 {}
10514 <pre>{#syntax#}error{#endsyntax#}</pre>10520 <pre>{#syntax#}error{#endsyntax#}</pre>
10515 </td>10521 </td>
10516 <td>10522 <td>
10517 {#syntax#}error{#endsyntax#} defines an anonymous error type.10523 {#syntax#}error{#endsyntax#} defines an error type.
10518 <ul>10524 <ul>
10519 <li>See also {#link|Errors#}</li>10525 <li>See also {#link|Errors#}</li>
10520 </ul>10526 </ul>
...@@ -10525,7 +10531,8 @@ fn readU32Be() u32 {}...@@ -10525,7 +10531,8 @@ fn readU32Be() u32 {}
10525 <pre>{#syntax#}export{#endsyntax#}</pre>10531 <pre>{#syntax#}export{#endsyntax#}</pre>
10526 </td>10532 </td>
10527 <td>10533 <td>
10528 {#syntax#}export{#endsyntax#} makes a function externally visible in the generated object file, and makes it use the C ABI.10534 {#syntax#}export{#endsyntax#} makes a function or variable externally visible in the generated object file.
10535 Exported functions default to the C calling convention.
10529 <ul>10536 <ul>
10530 <li>See also {#link|Functions#}</li>10537 <li>See also {#link|Functions#}</li>
10531 </ul>10538 </ul>
...@@ -10536,7 +10543,8 @@ fn readU32Be() u32 {}...@@ -10536,7 +10543,8 @@ fn readU32Be() u32 {}
10536 <pre>{#syntax#}extern{#endsyntax#}</pre>10543 <pre>{#syntax#}extern{#endsyntax#}</pre>
10537 </td>10544 </td>
10538 <td>10545 <td>
10539 {#syntax#}extern{#endsyntax#} can be used to declare a function that will be resolved at link time, when linking statically, or at runtime, when linking dynamically.10546 {#syntax#}extern{#endsyntax#} can be used to declare a function or variable that will be resolved at link time, when linking statically
10547 or at runtime, when linking dynamically.
10540 <ul>10548 <ul>
10541 <li>See also {#link|Functions#}</li>10549 <li>See also {#link|Functions#}</li>
10542 </ul>10550 </ul>
...@@ -10569,7 +10577,7 @@ fn readU32Be() u32 {}...@@ -10569,7 +10577,7 @@ fn readU32Be() u32 {}
10569 <pre>{#syntax#}for{#endsyntax#}</pre>10577 <pre>{#syntax#}for{#endsyntax#}</pre>
10570 </td>10578 </td>
10571 <td>10579 <td>
10572 A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice or array.10580 A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice, array, or tuple.
10573 <ul>10581 <ul>
10574 <li>See also {#link|for#}</li>10582 <li>See also {#link|for#}</li>
10575 </ul>10583 </ul>
...@@ -10648,7 +10656,7 @@ fn readU32Be() u32 {}...@@ -10648,7 +10656,7 @@ fn readU32Be() u32 {}
10648 <pre>{#syntax#}orelse{#endsyntax#}</pre>10656 <pre>{#syntax#}orelse{#endsyntax#}</pre>
10649 </td>10657 </td>
10650 <td>10658 <td>
10651 {#syntax#}orelse{#endsyntax#} can be used to provide a default value for an optional expression if it evaluates to null.10659 {#syntax#}orelse{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to null.
10652 <ul>10660 <ul>
10653 <li>See also {#link|Optionals#}, {#link|Operators#}</li>10661 <li>See also {#link|Optionals#}, {#link|Operators#}</li>
10654 </ul>10662 </ul>
...@@ -10659,7 +10667,8 @@ fn readU32Be() u32 {}...@@ -10659,7 +10667,8 @@ fn readU32Be() u32 {}
10659 <pre>{#syntax#}packed{#endsyntax#}</pre>10667 <pre>{#syntax#}packed{#endsyntax#}</pre>
10660 </td>10668 </td>
10661 <td>10669 <td>
10662 The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout to the guaranteed {#syntax#}packed{#endsyntax#} layout.10670 The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout
10671 to the guaranteed {#syntax#}packed{#endsyntax#} layout.
10663 <ul>10672 <ul>
10664 <li>See also {#link|packed struct#}</li>10673 <li>See also {#link|packed struct#}</li>
10665 </ul>10674 </ul>
...@@ -10670,7 +10679,8 @@ fn readU32Be() u32 {}...@@ -10670,7 +10679,8 @@ fn readU32Be() u32 {}
10670 <pre>{#syntax#}pub{#endsyntax#}</pre>10679 <pre>{#syntax#}pub{#endsyntax#}</pre>
10671 </td>10680 </td>
10672 <td>10681 <td>
10673 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.10682 The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the declaration available
10683 to reference from a different file than the one it is declared in.
10674 <ul>10684 <ul>
10675 <li>See also {#link|import#}</li>10685 <li>See also {#link|import#}</li>
10676 </ul>10686 </ul>
...@@ -10714,7 +10724,7 @@ fn readU32Be() u32 {}...@@ -10714,7 +10724,7 @@ fn readU32Be() u32 {}
10714 <pre>{#syntax#}struct{#endsyntax#}</pre>10724 <pre>{#syntax#}struct{#endsyntax#}</pre>
10715 </td>10725 </td>
10716 <td>10726 <td>
10717 {#syntax#}struct{#endsyntax#} defines an anonymous struct.10727 {#syntax#}struct{#endsyntax#} defines a struct.
10718 <ul>10728 <ul>
10719 <li>See also {#link|struct#}</li>10729 <li>See also {#link|struct#}</li>
10720 </ul>10730 </ul>
...@@ -10726,7 +10736,8 @@ fn readU32Be() u32 {}...@@ -10726,7 +10736,8 @@ fn readU32Be() u32 {}
10726 </td>10736 </td>
10727 <td>10737 <td>
10728 {#syntax#}suspend{#endsyntax#} will cause control flow to return to the call site or resumer of the function.10738 {#syntax#}suspend{#endsyntax#} will cause control flow to return to the call site or resumer of the function.
10729 {#syntax#}suspend{#endsyntax#} can also be used before a block within a function, to allow the function access to it's frame before control flow returns to the call site.10739 {#syntax#}suspend{#endsyntax#} can also be used before a block within a function,
10740 to allow the function access to its frame before control flow returns to the call site.
10730 <ul>10741 <ul>
10731 <li>See also {#link|Suspend and Resume#}</li>10742 <li>See also {#link|Suspend and Resume#}</li>
10732 </ul>10743 </ul>
...@@ -10737,7 +10748,8 @@ fn readU32Be() u32 {}...@@ -10737,7 +10748,8 @@ fn readU32Be() u32 {}
10737 <pre>{#syntax#}switch{#endsyntax#}</pre>10748 <pre>{#syntax#}switch{#endsyntax#}</pre>
10738 </td>10749 </td>
10739 <td>10750 <td>
10740 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#}.10751 A {#syntax#}switch{#endsyntax#} expression can be used to test values of a common type.
10752 {#syntax#}switch{#endsyntax#} cases can capture field values of a {#link|Tagged union#}.
10741 <ul>10753 <ul>
10742 <li>See also {#link|switch#}</li>10754 <li>See also {#link|switch#}</li>
10743 </ul>10755 </ul>
...@@ -10748,7 +10760,8 @@ fn readU32Be() u32 {}...@@ -10748,7 +10760,8 @@ fn readU32Be() u32 {}
10748 <pre>{#syntax#}test{#endsyntax#}</pre>10760 <pre>{#syntax#}test{#endsyntax#}</pre>
10749 </td>10761 </td>
10750 <td>10762 <td>
10751 The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code used to make sure behavior meets expectations.10763 The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code
10764 used to make sure behavior meets expectations.
10752 <ul>10765 <ul>
10753 <li>See also {#link|Zig Test#}</li>10766 <li>See also {#link|Zig Test#}</li>
10754 </ul>10767 </ul>
...@@ -10805,7 +10818,7 @@ fn readU32Be() u32 {}...@@ -10805,7 +10818,7 @@ fn readU32Be() u32 {}
10805 <pre>{#syntax#}union{#endsyntax#}</pre>10818 <pre>{#syntax#}union{#endsyntax#}</pre>
10806 </td>10819 </td>
10807 <td>10820 <td>
10808 {#syntax#}union{#endsyntax#} defines an anonymous union.10821 {#syntax#}union{#endsyntax#} defines a union.
10809 <ul>10822 <ul>
10810 <li>See also {#link|union#}</li>10823 <li>See also {#link|union#}</li>
10811 </ul>10824 </ul>
...@@ -10816,6 +10829,7 @@ fn readU32Be() u32 {}...@@ -10816,6 +10829,7 @@ fn readU32Be() u32 {}
10816 <pre>{#syntax#}unreachable{#endsyntax#}</pre>10829 <pre>{#syntax#}unreachable{#endsyntax#}</pre>
10817 </td>10830 </td>
10818 <td>10831 <td>
10832 {#syntax#}unreachable{#endsyntax#} can be used to assert that control flow will never happen upon a particular location.
10819 Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic.10833 Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic.
10820 <ul>10834 <ul>
10821 <li>Emits a panic in {#syntax#}Debug{#endsyntax#} and {#syntax#}ReleaseSafe{#endsyntax#} mode, or when using <code>zig test</code>.</li>10835 <li>Emits a panic in {#syntax#}Debug{#endsyntax#} and {#syntax#}ReleaseSafe{#endsyntax#} mode, or when using <code>zig test</code>.</li>
...@@ -10829,7 +10843,8 @@ fn readU32Be() u32 {}...@@ -10829,7 +10843,8 @@ fn readU32Be() u32 {}
10829 <pre>{#syntax#}usingnamespace{#endsyntax#}</pre>10843 <pre>{#syntax#}usingnamespace{#endsyntax#}</pre>
10830 </td>10844 </td>
10831 <td>10845 <td>
10832 {#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.10846 {#syntax#}usingnamespace{#endsyntax#} is a top-level declaration that imports all the public declarations of the operand,
10847 which must be a struct, union, or enum, into the current scope.
10833 <ul>10848 <ul>
10834 <li>See also {#link|usingnamespace#}</li>10849 <li>See also {#link|usingnamespace#}</li>
10835 </ul>10850 </ul>
...@@ -10863,7 +10878,8 @@ fn readU32Be() u32 {}...@@ -10863,7 +10878,8 @@ fn readU32Be() u32 {}
10863 <pre>{#syntax#}while{#endsyntax#}</pre>10878 <pre>{#syntax#}while{#endsyntax#}</pre>
10864 </td>10879 </td>
10865 <td>10880 <td>
10866 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.10881 A {#syntax#}while{#endsyntax#} expression can be used to repeatedly test a boolean, optional, or error union expression,
10882 and cease looping when that expression evaluates to false, null, or an error, respectively.
10867 <ul>10883 <ul>
10868 <li>See also {#link|while#}</li>10884 <li>See also {#link|while#}</li>
10869 </ul>10885 </ul>