std::file

Macro std::file

macro_rules! file {
    () => { ... };
}

A macro which expands to the file name from which it was invoked.

The expanded expression has type &'static str, and the returned file is not the invocation of the file!() macro itself, but rather the first macro invocation leading up to the invocation of the file!() macro.

Examples

let this_file = file!();
println!("defined in file: {}", this_file);

© 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.file.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部