| ... | ... | @@ -4809,6 +4809,182 @@ pub const TypeId = enum { |
| 4809 | 4809 | BoundFn, |
| 4810 | 4810 | ArgTuple, |
| 4811 | 4811 | Opaque, |
| 4812 | }; |
| 4813 | {#code_end#} |
| 4814 | {#header_close#} |
| 4815 | {#header_open|@typeInfo#} |
| 4816 | <pre><code class="zig">@typeInfo(comptime T: type) -&gt; @import("builtin").TypeInfo</code></pre> |
| 4817 | <p> |
| 4818 | Returns information on the type. Returns a value of the following union: |
| 4819 | </p> |
| 4820 | {#code_begin|syntax#} |
| 4821 | pub const TypeInfo = union(TypeId) { |
| 4822 | Type: void, |
| 4823 | Void: void, |
| 4824 | Bool: void, |
| 4825 | NoReturn: void, |
| 4826 | Int: Int, |
| 4827 | Float: Float, |
| 4828 | Pointer: Pointer, |
| 4829 | Array: Array, |
| 4830 | Struct: Struct, |
| 4831 | FloatLiteral: void, |
| 4832 | IntLiteral: void, |
| 4833 | UndefinedLiteral: void, |
| 4834 | NullLiteral: void, |
| 4835 | Nullable: Nullable, |
| 4836 | ErrorUnion: ErrorUnion, |
| 4837 | ErrorSet: ErrorSet, |
| 4838 | Enum: Enum, |
| 4839 | Union: Union, |
| 4840 | Fn: Fn, |
| 4841 | Namespace: void, |
| 4842 | Block: void, |
| 4843 | BoundFn: Fn, |
| 4844 | ArgTuple: void, |
| 4845 | Opaque: void, |
| 4846 | Promise: Promise, |
| 4847 | |
| 4848 | |
| 4849 | pub const Int = struct { |
| 4850 | is_signed: bool, |
| 4851 | bits: u8, |
| 4852 | }; |
| 4853 | |
| 4854 | pub const Float = struct { |
| 4855 | bits: u8, |
| 4856 | }; |
| 4857 | |
| 4858 | pub const Pointer = struct { |
| 4859 | is_const: bool, |
| 4860 | is_volatile: bool, |
| 4861 | alignment: u32, |
| 4862 | child: type, |
| 4863 | }; |
| 4864 | |
| 4865 | pub const Array = struct { |
| 4866 | len: usize, |
| 4867 | child: type, |
| 4868 | }; |
| 4869 | |
| 4870 | pub const ContainerLayout = enum { |
| 4871 | Auto, |
| 4872 | Extern, |
| 4873 | Packed, |
| 4874 | }; |
| 4875 | |
| 4876 | pub const StructField = struct { |
| 4877 | name: []const u8, |
| 4878 | offset: ?usize, |
| 4879 | field_type: type, |
| 4880 | }; |
| 4881 | |
| 4882 | pub const Struct = struct { |
| 4883 | layout: ContainerLayout, |
| 4884 | fields: []StructField, |
| 4885 | defs: []Definition, |
| 4886 | }; |
| 4887 | |
| 4888 | pub const Nullable = struct { |
| 4889 | child: type, |
| 4890 | }; |
| 4891 | |
| 4892 | pub const ErrorUnion = struct { |
| 4893 | error_set: type, |
| 4894 | payload: type, |
| 4895 | }; |
| 4896 | |
| 4897 | pub const Error = struct { |
| 4898 | name: []const u8, |
| 4899 | value: usize, |
| 4900 | }; |
| 4901 | |
| 4902 | pub const ErrorSet = struct { |
| 4903 | errors: []Error, |
| 4904 | }; |
| 4905 | |
| 4906 | pub const EnumField = struct { |
| 4907 | name: []const u8, |
| 4908 | value: usize, |
| 4909 | }; |
| 4910 | |
| 4911 | pub const Enum = struct { |
| 4912 | layout: ContainerLayout, |
| 4913 | tag_type: type, |
| 4914 | fields: []EnumField, |
| 4915 | defs: []Definition, |
| 4916 | }; |
| 4917 | |
| 4918 | pub const UnionField = struct { |
| 4919 | name: []const u8, |
| 4920 | enum_field: ?EnumField, |
| 4921 | field_type: type, |
| 4922 | }; |
| 4923 | |
| 4924 | pub const Union = struct { |
| 4925 | layout: ContainerLayout, |
| 4926 | tag_type: type, |
| 4927 | fields: []UnionField, |
| 4928 | defs: []Definition, |
| 4929 | }; |
| 4930 | |
| 4931 | pub const CallingConvention = enum { |
| 4932 | Unspecified, |
| 4933 | C, |
| 4934 | Cold, |
| 4935 | Naked, |
| 4936 | Stdcall, |
| 4937 | Async, |
| 4938 | }; |
| 4939 | |
| 4940 | pub const FnArg = struct { |
| 4941 | is_generic: bool, |
| 4942 | is_noalias: bool, |
| 4943 | arg_type: type, |
| 4944 | }; |
| 4945 | |
| 4946 | pub const Fn = struct { |
| 4947 | calling_convention: CallingConvention, |
| 4948 | is_generic: bool, |
| 4949 | is_var_args: bool, |
| 4950 | return_type: type, |
| 4951 | async_allocator_type: type, |
| 4952 | args: []FnArg, |
| 4953 | }; |
| 4954 | |
| 4955 | pub const Promise = struct { |
| 4956 | child: type, |
| 4957 | }; |
| 4958 | |
| 4959 | pub const Definition = struct { |
| 4960 | name: []const u8, |
| 4961 | is_pub: bool, |
| 4962 | data: Data, |
| 4963 | |
| 4964 | pub const Data = union(enum) { |
| 4965 | Type: type, |
| 4966 | Var: type, |
| 4967 | Fn: FnDef, |
| 4968 | |
| 4969 | pub const FnDef = struct { |
| 4970 | fn_type: type, |
| 4971 | inline_type: Inline, |
| 4972 | calling_convention: CallingConvention, |
| 4973 | is_var_args: bool, |
| 4974 | is_extern: bool, |
| 4975 | is_export: bool, |
| 4976 | lib_name: ?[]const u8, |
| 4977 | return_type: type, |
| 4978 | arg_names: [][] const u8, |
| 4979 | |
| 4980 | pub const Inline = enum { |
| 4981 | Auto, |
| 4982 | Always, |
| 4983 | Never, |
| 4984 | }; |
| 4985 | }; |
| 4986 | }; |
| 4987 | }; |
| 4812 | 4988 | }; |
| 4813 | 4989 | {#code_end#} |
| 4814 | 4990 | {#header_close#} |
| ... | ... | @@ -5226,7 +5402,6 @@ pub const Os = enum { |
| 5226 | 5402 | rtems, |
| 5227 | 5403 | nacl, |
| 5228 | 5404 | cnk, |
| 5229 | | bitrig, |
| 5230 | 5405 | aix, |
| 5231 | 5406 | cuda, |
| 5232 | 5407 | nvcl, |
| ... | ... | @@ -5237,10 +5412,12 @@ pub const Os = enum { |
| 5237 | 5412 | watchos, |
| 5238 | 5413 | mesa3d, |
| 5239 | 5414 | contiki, |
| 5415 | amdpal, |
| 5240 | 5416 | zen, |
| 5241 | 5417 | }; |
| 5242 | 5418 | |
| 5243 | 5419 | pub const Arch = enum { |
| 5420 | armv8_3a, |
| 5244 | 5421 | armv8_2a, |
| 5245 | 5422 | armv8_1a, |
| 5246 | 5423 | armv8, |
| ... | ... | @@ -5260,9 +5437,29 @@ pub const Arch = enum { |
| 5260 | 5437 | armv5, |
| 5261 | 5438 | armv5te, |
| 5262 | 5439 | armv4t, |
| 5263 | | armeb, |
| 5440 | armebv8_3a, |
| 5441 | armebv8_2a, |
| 5442 | armebv8_1a, |
| 5443 | armebv8, |
| 5444 | armebv8r, |
| 5445 | armebv8m_baseline, |
| 5446 | armebv8m_mainline, |
| 5447 | armebv7, |
| 5448 | armebv7em, |
| 5449 | armebv7m, |
| 5450 | armebv7s, |
| 5451 | armebv7k, |
| 5452 | armebv7ve, |
| 5453 | armebv6, |
| 5454 | armebv6m, |
| 5455 | armebv6k, |
| 5456 | armebv6t2, |
| 5457 | armebv5, |
| 5458 | armebv5te, |
| 5459 | armebv4t, |
| 5264 | 5460 | aarch64, |
| 5265 | 5461 | aarch64_be, |
| 5462 | arc, |
| 5266 | 5463 | avr, |
| 5267 | 5464 | bpfel, |
| 5268 | 5465 | bpfeb, |
| ... | ... | @@ -5315,6 +5512,7 @@ pub const Arch = enum { |
| 5315 | 5512 | pub const Environ = enum { |
| 5316 | 5513 | unknown, |
| 5317 | 5514 | gnu, |
| 5515 | gnuabin32, |
| 5318 | 5516 | gnuabi64, |
| 5319 | 5517 | gnueabi, |
| 5320 | 5518 | gnueabihf, |
| ... | ... | @@ -5332,6 +5530,7 @@ pub const Environ = enum { |
| 5332 | 5530 | amdopencl, |
| 5333 | 5531 | coreclr, |
| 5334 | 5532 | opencl, |
| 5533 | simulator, |
| 5335 | 5534 | }; |
| 5336 | 5535 | |
| 5337 | 5536 | pub const ObjectFormat = enum { |
| ... | ... | @@ -5358,10 +5557,23 @@ pub const AtomicOrder = enum { |
| 5358 | 5557 | SeqCst, |
| 5359 | 5558 | }; |
| 5360 | 5559 | |
| 5560 | pub const AtomicRmwOp = enum { |
| 5561 | Xchg, |
| 5562 | Add, |
| 5563 | Sub, |
| 5564 | And, |
| 5565 | Nand, |
| 5566 | Or, |
| 5567 | Xor, |
| 5568 | Max, |
| 5569 | Min, |
| 5570 | }; |
| 5571 | |
| 5361 | 5572 | pub const Mode = enum { |
| 5362 | 5573 | Debug, |
| 5363 | 5574 | ReleaseSafe, |
| 5364 | 5575 | ReleaseFast, |
| 5576 | ReleaseSmall, |
| 5365 | 5577 | }; |
| 5366 | 5578 | |
| 5367 | 5579 | pub const TypeId = enum { |
| ... | ... | @@ -5380,7 +5592,7 @@ pub const TypeId = enum { |
| 5380 | 5592 | NullLiteral, |
| 5381 | 5593 | Nullable, |
| 5382 | 5594 | ErrorUnion, |
| 5383 | | Error, |
| 5595 | ErrorSet, |
| 5384 | 5596 | Enum, |
| 5385 | 5597 | Union, |
| 5386 | 5598 | Fn, |
| ... | ... | @@ -5389,6 +5601,176 @@ pub const TypeId = enum { |
| 5389 | 5601 | BoundFn, |
| 5390 | 5602 | ArgTuple, |
| 5391 | 5603 | Opaque, |
| 5604 | Promise, |
| 5605 | }; |
| 5606 | |
| 5607 | pub const TypeInfo = union(TypeId) { |
| 5608 | Type: void, |
| 5609 | Void: void, |
| 5610 | Bool: void, |
| 5611 | NoReturn: void, |
| 5612 | Int: Int, |
| 5613 | Float: Float, |
| 5614 | Pointer: Pointer, |
| 5615 | Array: Array, |
| 5616 | Struct: Struct, |
| 5617 | FloatLiteral: void, |
| 5618 | IntLiteral: void, |
| 5619 | UndefinedLiteral: void, |
| 5620 | NullLiteral: void, |
| 5621 | Nullable: Nullable, |
| 5622 | ErrorUnion: ErrorUnion, |
| 5623 | ErrorSet: ErrorSet, |
| 5624 | Enum: Enum, |
| 5625 | Union: Union, |
| 5626 | Fn: Fn, |
| 5627 | Namespace: void, |
| 5628 | Block: void, |
| 5629 | BoundFn: Fn, |
| 5630 | ArgTuple: void, |
| 5631 | Opaque: void, |
| 5632 | Promise: Promise, |
| 5633 | |
| 5634 | |
| 5635 | pub const Int = struct { |
| 5636 | is_signed: bool, |
| 5637 | bits: u8, |
| 5638 | }; |
| 5639 | |
| 5640 | pub const Float = struct { |
| 5641 | bits: u8, |
| 5642 | }; |
| 5643 | |
| 5644 | pub const Pointer = struct { |
| 5645 | is_const: bool, |
| 5646 | is_volatile: bool, |
| 5647 | alignment: u32, |
| 5648 | child: type, |
| 5649 | }; |
| 5650 | |
| 5651 | pub const Array = struct { |
| 5652 | len: usize, |
| 5653 | child: type, |
| 5654 | }; |
| 5655 | |
| 5656 | pub const ContainerLayout = enum { |
| 5657 | Auto, |
| 5658 | Extern, |
| 5659 | Packed, |
| 5660 | }; |
| 5661 | |
| 5662 | pub const StructField = struct { |
| 5663 | name: []const u8, |
| 5664 | offset: ?usize, |
| 5665 | field_type: type, |
| 5666 | }; |
| 5667 | |
| 5668 | pub const Struct = struct { |
| 5669 | layout: ContainerLayout, |
| 5670 | fields: []StructField, |
| 5671 | defs: []Definition, |
| 5672 | }; |
| 5673 | |
| 5674 | pub const Nullable = struct { |
| 5675 | child: type, |
| 5676 | }; |
| 5677 | |
| 5678 | pub const ErrorUnion = struct { |
| 5679 | error_set: type, |
| 5680 | payload: type, |
| 5681 | }; |
| 5682 | |
| 5683 | pub const Error = struct { |
| 5684 | name: []const u8, |
| 5685 | value: usize, |
| 5686 | }; |
| 5687 | |
| 5688 | pub const ErrorSet = struct { |
| 5689 | errors: []Error, |
| 5690 | }; |
| 5691 | |
| 5692 | pub const EnumField = struct { |
| 5693 | name: []const u8, |
| 5694 | value: usize, |
| 5695 | }; |
| 5696 | |
| 5697 | pub const Enum = struct { |
| 5698 | layout: ContainerLayout, |
| 5699 | tag_type: type, |
| 5700 | fields: []EnumField, |
| 5701 | defs: []Definition, |
| 5702 | }; |
| 5703 | |
| 5704 | pub const UnionField = struct { |
| 5705 | name: []const u8, |
| 5706 | enum_field: ?EnumField, |
| 5707 | field_type: type, |
| 5708 | }; |
| 5709 | |
| 5710 | pub const Union = struct { |
| 5711 | layout: ContainerLayout, |
| 5712 | tag_type: type, |
| 5713 | fields: []UnionField, |
| 5714 | defs: []Definition, |
| 5715 | }; |
| 5716 | |
| 5717 | pub const CallingConvention = enum { |
| 5718 | Unspecified, |
| 5719 | C, |
| 5720 | Cold, |
| 5721 | Naked, |
| 5722 | Stdcall, |
| 5723 | Async, |
| 5724 | }; |
| 5725 | |
| 5726 | pub const FnArg = struct { |
| 5727 | is_generic: bool, |
| 5728 | is_noalias: bool, |
| 5729 | arg_type: type, |
| 5730 | }; |
| 5731 | |
| 5732 | pub const Fn = struct { |
| 5733 | calling_convention: CallingConvention, |
| 5734 | is_generic: bool, |
| 5735 | is_var_args: bool, |
| 5736 | return_type: type, |
| 5737 | async_allocator_type: type, |
| 5738 | args: []FnArg, |
| 5739 | }; |
| 5740 | |
| 5741 | pub const Promise = struct { |
| 5742 | child: type, |
| 5743 | }; |
| 5744 | |
| 5745 | pub const Definition = struct { |
| 5746 | name: []const u8, |
| 5747 | is_pub: bool, |
| 5748 | data: Data, |
| 5749 | |
| 5750 | pub const Data = union(enum) { |
| 5751 | Type: type, |
| 5752 | Var: type, |
| 5753 | Fn: FnDef, |
| 5754 | |
| 5755 | pub const FnDef = struct { |
| 5756 | fn_type: type, |
| 5757 | inline_type: Inline, |
| 5758 | calling_convention: CallingConvention, |
| 5759 | is_var_args: bool, |
| 5760 | is_extern: bool, |
| 5761 | is_export: bool, |
| 5762 | lib_name: ?[]const u8, |
| 5763 | return_type: type, |
| 5764 | arg_names: [][] const u8, |
| 5765 | |
| 5766 | pub const Inline = enum { |
| 5767 | Auto, |
| 5768 | Always, |
| 5769 | Never, |
| 5770 | }; |
| 5771 | }; |
| 5772 | }; |
| 5773 | }; |
| 5392 | 5774 | }; |
| 5393 | 5775 | |
| 5394 | 5776 | pub const FloatMode = enum { |
| ... | ... | @@ -5402,7 +5784,7 @@ pub const Endian = enum { |
| 5402 | 5784 | }; |
| 5403 | 5785 | |
| 5404 | 5786 | pub const endian = Endian.Little; |
| 5405 | | pub const is_test = false; |
| 5787 | pub const is_test = true; |
| 5406 | 5788 | pub const os = Os.linux; |
| 5407 | 5789 | pub const arch = Arch.x86_64; |
| 5408 | 5790 | pub const environ = Environ.gnu; |
| ... | ... | @@ -5410,6 +5792,7 @@ pub const object_format = ObjectFormat.elf; |
| 5410 | 5792 | pub const mode = Mode.Debug; |
| 5411 | 5793 | pub const link_libc = false; |
| 5412 | 5794 | pub const have_error_return_tracing = true; |
| 5795 | pub const __zig_test_fn_slice = {}; // overwritten later |
| 5413 | 5796 | {#code_end#} |
| 5414 | 5797 | {#see_also|Build Mode#} |
| 5415 | 5798 | {#header_close#} |