ReadFromAsync

Trait ReadFromAsync 

Source
pub trait ReadFromAsync<'a, Vfs: VfsAsync + ?Sized + 'a>: Sized + 'a {
    type Future: Future<Output = VfsResult<Self, Vfs>> + Send + Unpin + 'a
       where Self: 'a;

    // Required method
    fn read_from_async(
        path: <<Vfs as VfsCore>::Path as PathType>::OwnedPath,
        vfs: Pin<&'a Vfs>,
    ) -> Self::Future;
}
Available on crate feature async only.
Expand description

Trait for types / structures that can be read from disk asynchronously.

async version of ReadFrom.

Required Associated Types§

Source

type Future: Future<Output = VfsResult<Self, Vfs>> + Send + Unpin + 'a where Self: 'a

The future type returned by the async read function.

Required Methods§

Source

fn read_from_async( path: <<Vfs as VfsCore>::Path as PathType>::OwnedPath, vfs: Pin<&'a Vfs>, ) -> Self::Future

Asynchronously reads the structure from the specified path, which can be either a file or a directory.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T, Vfs: VfsAsync + 'a> ReadFromAsync<'a, Vfs> for PhantomData<T>
where T: Send + Sync + 'static,

Source§

type Future = Ready<Result<PhantomData<T>, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>>

Source§

fn read_from_async( _path: <Vfs::Path as PathType>::OwnedPath, _vfs: Pin<&Vfs>, ) -> Self::Future

Source§

impl<'a, T, Vfs: VfsAsync<Path = P> + 'a, P: PathType + ?Sized + 'a> ReadFromAsync<'a, Vfs> for Option<T>
where T: ReadFromAsync<'a, Vfs> + 'static, T::Future: Future<Output = VfsResult<T, Vfs>> + Unpin + 'a,

Source§

type Future = OptionReadFromAsyncFuture<'a, T, P, Vfs> where Self: 'static

Source§

fn read_from_async(path: P::OwnedPath, vfs: Pin<&'a Vfs>) -> Self::Future

Source§

impl<'a, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for String

Source§

type Future = <Vfs as VfsAsync>::ReadStringFuture<'a>

Source§

fn read_from_async( path: <Vfs::Path as PathType>::OwnedPath, vfs: Pin<&'a Vfs>, ) -> Self::Future

Source§

impl<'a, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for Vec<u8>

Source§

type Future = VecReadFuture<'a, Vfs>

Source§

fn read_from_async( path: <Vfs::Path as PathType>::OwnedPath, vfs: Pin<&'a Vfs>, ) -> Self::Future

Source§

impl<'a, Vfs: VfsAsync + ?Sized + 'a> ReadFromAsync<'a, Vfs> for ()

Source§

type Future = Ready<Result<(), Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>>

Source§

fn read_from_async( _path: <<Vfs as VfsCore>::Path as PathType>::OwnedPath, _vfs: Pin<&'a Vfs>, ) -> Self::Future

Implementors§

Source§

impl<'a, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for FileBytes

Source§

type Future = Pin<Box<dyn Future<Output = Result<FileBytes, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'a>>

Source§

impl<'a, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for FileString

Source§

type Future = FileStringReadFuture<'a, Vfs>