pub async fn symlink_metadata<P: AsRef<Path>>(path: P) -> Result<Metadata>
Expand description
Query the metadata about a file without following symlinks.
§Platform-specific behavior
This function currently corresponds to the lstat
function on linux
§Errors
This function will return an error in the following situations, but is not limited to just these cases:
- The user lacks permissions to perform
metadata
call onpath
.- execute(search) permission is required on all of the directories in path that lead to the file.
path
does not exist.
§Examples
use monoio::fs;
#[monoio::main]
async fn main() -> std::io::Result<()> {
let attr = fs::symlink_metadata("/some/file/path.txt").await?;
// inspect attr ...
Ok(())
}