[][src]Struct async_std::fs::Metadata

pub struct Metadata { /* fields omitted */ }

Metadata for a file or directory.

Metadata is returned by metadata and symlink_metadata.

This type is a re-export of std::fs::Metadata.

Methods

impl Metadata[src]

pub fn file_type(&self) -> FileType[src]

Returns the file type from this metadata.

Examples

use async_std::fs;

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

pub fn is_dir(&self) -> bool[src]

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());

pub fn is_file(&self) -> bool[src]

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());

pub fn len(&self) -> u64[src]

Returns the file size in bytes.

Examples

use async_std::fs;

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

pub fn permissions(&self) -> Permissions[src]

Returns the permissions from this metadata.

Examples

use async_std::fs;

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

pub fn modified(&self) -> Result<SystemTime>[src]

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());

pub fn accessed(&self) -> Result<SystemTime>[src]

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());

pub fn created(&self) -> Result<SystemTime>[src]

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());

Trait Implementations

impl Clone for Metadata[src]

impl Debug for Metadata[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]