跳到主要内容

try_exists

搜索

函数 try_exists 

Source
pub async fn try_exists(path: impl AsRef<Path>) -> Result<bool>
展开描述

如果路径指向一个已存在的实体,则返回 Ok(true)

此函数会遍历符号链接以查询目标文件的信息。 In case of broken symbolic links this will return Ok(false).

这是 std::path::Path::try_exists.

§示例

use tokio::fs;

fs::try_exists("foo.txt").await?;