accessor: use aio Decoder in aio Accessor

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-06-02 12:58:29 +02:00
parent da286c2802
commit afe05f3ffa
2 changed files with 7 additions and 1 deletions

View File

@ -13,7 +13,7 @@ use std::sync::Arc;
use std::task::{Context, Poll};
use crate::accessor::{self, cache::Cache, ReadAt};
use crate::decoder::Decoder;
use crate::decoder::aio::Decoder;
use crate::format::GoodbyeItem;
use crate::poll_fn::poll_fn;
use crate::Entry;

View File

@ -51,6 +51,12 @@ impl<T: SeqRead> Decoder<T> {
})
}
/// Internal helper for `Accessor`. In this case we have the low-level state machine, and the
/// layer "above" the `Accessor` propagates the actual type (sync vs async).
pub(crate) fn from_impl(inner: decoder::DecoderImpl<T>) -> Self {
Self { inner }
}
/// If this is a directory entry, get the next item inside the directory.
pub async fn next(&mut self) -> Option<io::Result<Entry>> {
self.inner.next_do().await.transpose()