Skip to main content
Version: dev

fmtstr

fmtstr<N, T> is the type resulting from using format string (f"...").

Methods

quoted_contents

quoted_contents
pub comptime fn quoted_contents(self) -> Quoted {}

Source code: noir_stdlib/src/meta/format_string.nr#L6-L8

Returns the format string contents (that is, without the leading and trailing double quotes) as a Quoted value.

as_quoted_str

as_quoted_str
pub comptime fn as_quoted_str(self) -> Quoted {

Source code: noir_stdlib/src/meta/format_string.nr#L11-L13

Returns the format string contents (with the leading and trailing double quotes) as a Quoted string literal (not a format string literal).

Example:

as_quoted_str_test
comptime {
let x = 1;
let f: str<_> = f"x = {x}".as_quoted_str!();
assert_eq(f, "x = 0x01");
}

Source code: test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr#L19-L25