std::format

Macro std::format

macro_rules! format {
    ( $ ( $ arg : tt ) * ) => { ... };
}

Use the syntax described in std::fmt to create a value of type String. See std::fmt for more information.

Panics

format! panics if a formatting trait implementation returns an error. This indicates an incorrect implementation since fmt::Write for String never returns an error itself.

Examples

format!("test");
format!("hello {}", "world!");
format!("x = {}, y = {y}", 10, y = 30);

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/macro.format.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部