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, T, F, Vfs: VfsAsync + 'a> ReadFromAsync<'a, Vfs> for DirChildren<T, F, Vfs::Path>
where T: ReadFromAsync<'a, Vfs> + Send + 'static, F: Filter<Vfs::Path> + Send + 'static, T::Future: Future<Output = VfsResult<T, Vfs>> + Unpin + 'static,

Source§

type Future = DirChildrenReadAsyncFuture<'a, T, F, Vfs>

Source§

impl<'a, T, F, Vfs: VfsAsync + 'a> ReadFromAsync<'a, Vfs> for ForceCreateDirChildren<T, F, Vfs::Path>
where T: ReadFromAsync<'a, Vfs> + Send + Sync + 'static, F: Filter<Vfs::Path> + Send + Sync + 'static, T::Future: Future<Output = VfsResult<T, Vfs>> + Unpin + 'static,

Source§

type Future = ForceCreateDirChildrenReadAsyncFuture<'a, T, F, Vfs>

Source§

impl<'a, T, H, Vfs: VfsAsync + 'a> ReadFromAsync<'a, Vfs> for VersionedHash<T, Vfs::Path, H>
where T: ReadFromAsync<'a, Vfs> + Hash + 'a, H: Hasher + Default + 'a,

Source§

type Future = Pin<Box<dyn Future<Output = Result<VersionedHash<T, <Vfs as VfsCore>::Path, H>, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'a>> where Self: 'a

Source§

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

Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for Json<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature json only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for JsonPretty<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature json only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for Ron<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature ron only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for RonPretty<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature ron only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for Toml<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature toml only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for Yaml<T>
where T: Serialize + for<'d> Deserialize<'d> + 'static,

Available on crate feature yaml only.
Source§

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

Source§

impl<'a, T, Vfs: VfsAsync + 'static> ReadFromAsync<'a, Vfs> for FmtWrapper<T>
where T: FromStr + Send + 'static, T::Err: Into<Box<dyn Error + Send + Sync>>,

Source§

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

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>

Source§

impl<'a, Vfs: VfsAsync + 'static, T: ReadFromAsync<'a, Vfs> + Send + 'static> ReadFromAsync<'a, Vfs> for Versioned<T, Vfs::Path>

Source§

type Future = VersionedReadFuture<'a, Vfs, T>

Source§

impl<'a, const CHECK_ON_READ: bool, T, Vfs: VfsAsync<Path = P> + 'static, P: PathType + ?Sized + 'a> ReadFromAsync<'a, Vfs> for DeferredReadOrOwn<'a, T, Vfs, CHECK_ON_READ>
where T: ReadFromAsync<'a, Vfs> + Send + 'static, P::OwnedPath: Send + Sync,

Source§

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

Source§

impl<'a, const CHECK_ON_READ: bool, T, Vfs: VfsAsync<Path = P> + 'static, P: PathType + ?Sized + 'a> ReadFromAsync<'a, Vfs> for DeferredRead<'a, T, Vfs, CHECK_ON_READ>
where T: Send + ReadFromAsync<'a, Vfs> + 'static,

Source§

type Future = Pin<Box<dyn Future<Output = Result<DeferredRead<'a, T, Vfs, CHECK_ON_READ>, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'a>> where Self: 'a

Source§

impl<'vfs, P: PathType + ?Sized + 'vfs, Vfs: VfsAsync<Path = P> + 'static, T: ReadFromAsync<'vfs, Vfs> + Send + 'static, F: FolderFilter<P> + FolderRecurseFilter<P> + FileFilter<P> + 'vfs> ReadFromAsync<'vfs, Vfs> for DirDescendants<T, F, P>
where for<'f> Vfs::IsDirFuture<'f>: Future<Output = VfsResult<bool, Vfs>> + Send + 'f,

Source§

type Future = Pin<Box<dyn Future<Output = Result<DirDescendants<T, F, P>, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'vfs>> where Self: 'vfs

Source§

impl<'vfs, T, Vfs: VfsAsync + 'vfs> ReadFromAsync<'vfs, Vfs> for AtomicDir<T>
where T: ReadFromAsync<'vfs, Vfs> + Send + 'static,

Source§

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

Source§

impl<'vfs, Vfs, T> ReadFromAsync<'vfs, Vfs> for T
where Vfs: VfsAsync + ReadImageFromAsync<T> + 'vfs, T: ImgFormat + Send + 'vfs,

Available on crate feature image only.
Source§

impl<'vfs, Vfs, T, P> ReadFromAsync<'vfs, Vfs> for TryParse<T, P>
where P: PathType + 'vfs, Vfs: VfsAsync<Path = P> + 'vfs, T: ReadFromAsync<'vfs, Vfs> + Send + 'vfs,

Source§

type Future = Pin<Box<dyn Future<Output = Result<TryParse<T, P>, Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'vfs>>