如何在 Rust 中获取没有扩展名的文件路径?

How to get file path without extension in Rust?

请帮我找到一种优雅的方法来获取不带扩展名的文件路径;从路径或其他内容中删除文件扩展名。

勾选Path::file_stem method。你可以在那里找到一个例子。它至少适用于 Rust 1.6。

使用 Path::with_extension("") method 为您提供删除了可能的文件扩展名的完整路径。