Skip to main content

File

Trait File 

Source
pub trait File:
    AsyncRead
    + AsyncSeek
    + Unpin
    + Send
    + Sync {
    type Metadata: Metadata;
    type MetadataFuture<'a>: Future<Output = Result<Self::Metadata>> + Send
       where Self: 'a;

    // Required method
    fn metadata(&self) -> Self::MetadataFuture<'_>;
}
Available on crate feature fs only.
Expand description

Trait for an opened file.

Must support async reading and seeking (for HTTP range requests). In-memory backends can use std::io::Cursor to satisfy the AsyncSeek requirement.

Required Associated Types§

Source

type Metadata: Metadata

The metadata type returned by this file.

Source

type MetadataFuture<'a>: Future<Output = Result<Self::Metadata>> + Send where Self: 'a

Future returned by File::metadata.

Required Methods§

Source

fn metadata(&self) -> Self::MetadataFuture<'_>

Returns metadata for this opened file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§