async fn write(
        &mut self,
        offset: u64,
        data: &[u8],
        ) -> Result<(), Self::Error>
    {
        let data = Vec::from(data);
        let this = Arc::clone(&self.0);
        let (tx, rx) = async_channel::bounded(1);

        spawn_local(async move {
            let data = Uint8Array::from(data.as_slice());
            let ram = this.lock().await;
            let result = ram.write_js(offset, data.into()).await
                .map_err(|_| anyhow!("Error calling write_js.").into());
            tx.send(result).await.unwrap();
        });

        rx.recv().await?
    }
/// Write bytes at an offset to the backend.
Write bytes at an offset to the backend.
Write bytes at an offset to the backend .
async fn write(
        &mut self,
        offset: u64,
        data: &[u8],
        ) -> Result<(), Self::Error>
    {
        let data = Vec::from(data);
        let this = Arc::clone(&self.0);
        let (tx, rx) = async_channel::bounded(1);
        spawn_local(async move {
            let data = Uint8Array::from(data.as_slice());
            let ram = this.lock().await;
            let result = ram.write_js(offset, data.into()).await
                .map_err(|_| anyhow!("Error calling write_js.").into());
            tx.send(result).await.unwrap();
        });
        rx.recv().await?
    }
async fn write ( & mut self , offset : u64 , data : & [ u8 ] , ) -> Result < ( ) , Self :: Error > { let data = Vec :: from ( data ) ; let this = Arc :: clone ( & self . 0 ) ; let ( tx , rx ) = async_channel :: bounded ( 1 ) ; spawn_local ( async move { let data = Uint8Array :: from ( data . as_slice ( ) ) ; let ram = this . lock ( ) . await ; let result = ram . write_js ( offset , data . into ( ) ) . await . map_err ( | _ | anyhow ! ( " " ) . into ( ) ) ; tx . send ( result ) . await . unwrap ( ) ; } ) ; rx . recv ( ) . await ? }
Write bytes at an offset to the backend.
Write bytes at an offset to the backend .
&mut self
offset
u64
data
&[u8]
&mut self
offset
u64
data
&[u8]