Metadata in async_std::fs - Rust (original) (raw)

pub struct Metadata { /* private fields */ }

Expand description

Source§

Source

Returns the file type from this metadata.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.file_type());

Source

Returns true if this metadata is for a regular directory.

If this metadata is for a symbolic link, this method returns false.

§Examples
use async_std::fs;

let metadata = fs::metadata(".").await?;
println!("{:?}", metadata.is_dir());

Source

Returns true if this metadata is for a regular file.

If this metadata is for a symbolic link, this method returns false.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.is_file());

Source

Returns the file size in bytes.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{}", metadata.len());

Source

Returns the permissions from this metadata.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.permissions());

Source

Returns the last modification time.

§Errors

This data may not be available on all platforms, in which case an error will be returned.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.modified());

Source

Returns the last access time.

§Errors

This data may not be available on all platforms, in which case an error will be returned.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.accessed());

Source

Returns the creation time.

§Errors

This data may not be available on all platforms, in which case an error will be returned.

§Examples
use async_std::fs;

let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.created());

§

§

§

§

§

§