browser-fs 0.1.0

A browser-based filesystem implementation for WebAssembly applications
Documentation
use std::io::Result;
use std::pin::Pin;
use std::task::{Context, Poll};

use futures_lite::AsyncRead;

use crate::external::read_access_handle;

impl AsyncRead for crate::File {
    fn poll_read(
        mut self: Pin<&mut Self>,
        _cx: &mut Context<'_>,
        buf: &mut [u8],
    ) -> Poll<Result<usize>> {
        let received: u32 = read_access_handle(&self.access, buf, self.offset);
        self.offset += received;
        Poll::Ready(Ok(received as usize))
    }
}