| ... | ... | @@ -8030,7 +8030,29 @@ test "vector @splat" { |
| 8030 | 8030 | </p> |
| 8031 | 8031 | {#see_also|Vectors|@shuffle#} |
| 8032 | 8032 | {#header_close#} |
| 8033 | {#header_open|@src#} |
| 8034 | <pre>{#syntax#}@src() std.builtin.SourceLocation{#endsyntax#}</pre> |
| 8035 | <p> |
| 8036 | Returns a {#syntax#}SourceLocation{#endsyntax#} struct representing the function's name and location in the source code. This must be called in a function. |
| 8037 | </p> |
| 8038 | {#code_begin|test#} |
| 8039 | const std = @import("std"); |
| 8040 | const expect = std.testing.expect; |
| 8041 | |
| 8042 | test "@src" { |
| 8043 | doTheTest(); |
| 8044 | } |
| 8045 | |
| 8046 | fn doTheTest() void { |
| 8047 | const src = @src(); |
| 8033 | 8048 | |
| 8049 | expect(src.line == 9); |
| 8050 | expect(src.column == 17); |
| 8051 | expect(std.mem.endsWith(u8, src.fn_name, "doTheTest")); |
| 8052 | expect(std.mem.endsWith(u8, src.file, "test.zig")); |
| 8053 | } |
| 8054 | {#code_end#} |
| 8055 | {#header_close#} |
| 8034 | 8056 | {#header_open|@sqrt#} |
| 8035 | 8057 | <pre>{#syntax#}@sqrt(value: var) @TypeOf(value){#endsyntax#}</pre> |
| 8036 | 8058 | <p> |