tokio-fs-ext 0.6.0

Extend tokio fs to be compatible with native and wasm
Documentation
use tokio::sync::mpsc;

use super::{FsOffload, FsOffloadDefault, FsTask};

pub struct Server {
    pub(super) receiver: mpsc::Receiver<FsTask>,
}

impl Server {
    pub async fn serve(&mut self, offload: impl FsOffload) {
        while let Some(task) = self.receiver.recv().await {
            task.execute(&offload).await;
        }
    }

    pub async fn serve_default(&mut self) {
        self.serve(FsOffloadDefault).await
    }
}