Skip to content

Commit e6f651e

Browse files
committed
Even more.
1 parent b9adf78 commit e6f651e

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

crates/wasi/src/preview2/host/io.rs

+27-19
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,10 @@ impl<T: WasiView + Sync> streams::HostInputStream for T {
449449

450450
pub mod sync {
451451
use crate::preview2::{
452-
bindings::io::streams::{self as async_streams, Host as AsyncHost},
452+
bindings::io::streams::{
453+
self as async_streams, HostInputStream as AsyncHostInputStream,
454+
HostOutputStream as AsyncHostOutputStream,
455+
},
453456
bindings::sync_io::io::poll::Pollable,
454457
bindings::sync_io::io::streams::{self, InputStream, OutputStream},
455458
host::io::sync::streams::{HostInputStream, HostOutputStream},
@@ -495,12 +498,12 @@ pub mod sync {
495498

496499
impl<T: WasiView + Sync> HostOutputStream for T {
497500
fn drop(&mut self, stream: Resource<OutputStream>) -> anyhow::Result<()> {
498-
AsyncHost::drop(self, stream)
501+
AsyncHostOutputStream::drop(self, stream)
499502
}
500503

501504
fn check_write(&mut self, stream: Resource<OutputStream>) -> Result<u64, streams::Error> {
502505
Ok(in_tokio(async {
503-
AsyncHost::check_write(self, stream).await
506+
AsyncHostOutputStream::check_write(self, stream).await
504507
})?)
505508
}
506509
fn write(
@@ -509,7 +512,7 @@ pub mod sync {
509512
bytes: Vec<u8>,
510513
) -> Result<(), streams::Error> {
511514
Ok(in_tokio(async {
512-
AsyncHost::write(self, stream, bytes).await
515+
AsyncHostOutputStream::write(self, stream, bytes).await
513516
})?)
514517
}
515518
fn blocking_write_and_flush(
@@ -518,7 +521,7 @@ pub mod sync {
518521
bytes: Vec<u8>,
519522
) -> Result<(), streams::Error> {
520523
Ok(in_tokio(async {
521-
AsyncHost::blocking_write_and_flush(self, stream, bytes).await
524+
AsyncHostOutputStream::blocking_write_and_flush(self, stream, bytes).await
522525
})?)
523526
}
524527
fn blocking_write_zeroes_and_flush(
@@ -527,31 +530,33 @@ pub mod sync {
527530
len: u64,
528531
) -> Result<(), streams::Error> {
529532
Ok(in_tokio(async {
530-
AsyncHost::blocking_write_zeroes_and_flush(self, stream, len).await
533+
AsyncHostOutputStream::blocking_write_zeroes_and_flush(self, stream, len).await
531534
})?)
532535
}
533536
fn subscribe(
534537
&mut self,
535538
stream: Resource<OutputStream>,
536539
) -> anyhow::Result<Resource<Pollable>> {
537-
AsyncHost::subscribe_to_output_stream(self, stream)
540+
AsyncHostOutputStream::subscribe(self, stream)
538541
}
539542
fn write_zeroes(
540543
&mut self,
541544
stream: Resource<OutputStream>,
542545
len: u64,
543546
) -> Result<(), streams::Error> {
544547
Ok(in_tokio(async {
545-
AsyncHost::write_zeroes(self, stream, len).await
548+
AsyncHostOutputStream::write_zeroes(self, stream, len).await
546549
})?)
547550
}
548551

549552
fn flush(&mut self, stream: Resource<OutputStream>) -> Result<(), streams::Error> {
550-
Ok(in_tokio(async { AsyncHost::flush(self, stream).await })?)
553+
Ok(in_tokio(async {
554+
AsyncHostOutputStream::flush(self, stream).await
555+
})?)
551556
}
552557
fn blocking_flush(&mut self, stream: Resource<OutputStream>) -> Result<(), streams::Error> {
553558
Ok(in_tokio(async {
554-
AsyncHost::blocking_flush(self, stream).await
559+
AsyncHostOutputStream::blocking_flush(self, stream).await
555560
})?)
556561
}
557562

@@ -561,7 +566,7 @@ pub mod sync {
561566
src: Resource<InputStream>,
562567
len: u64,
563568
) -> anyhow::Result<Result<(u64, streams::StreamStatus), ()>> {
564-
in_tokio(async { AsyncHost::splice(self, src, dst, len).await }).map(xform)
569+
in_tokio(async { AsyncHostOutputStream::splice(self, dst, src, len).await }).map(xform)
565570
}
566571

567572
fn blocking_splice(
@@ -570,60 +575,63 @@ pub mod sync {
570575
src: Resource<InputStream>,
571576
len: u64,
572577
) -> anyhow::Result<Result<(u64, streams::StreamStatus), ()>> {
573-
in_tokio(async { AsyncHost::blocking_splice(self, src, dst, len).await }).map(xform)
578+
in_tokio(async { AsyncHostOutputStream::blocking_splice(self, dst, src, len).await })
579+
.map(xform)
574580
}
575581

576582
fn forward(
577583
&mut self,
578584
dst: Resource<OutputStream>,
579585
src: Resource<InputStream>,
580586
) -> anyhow::Result<Result<(u64, streams::StreamStatus), ()>> {
581-
in_tokio(async { AsyncHost::forward(self, src, dst).await }).map(xform)
587+
in_tokio(async { AsyncHostOutputStream::forward(self, dst, src).await }).map(xform)
582588
}
583589
}
584590

585591
impl<T: WasiView + Sync> HostInputStream for T {
586592
fn drop(&mut self, stream: Resource<InputStream>) -> anyhow::Result<()> {
587-
AsyncHost::drop(self, stream)
593+
AsyncHostInputStream::drop(self, stream)
588594
}
589595

590596
fn read(
591597
&mut self,
592598
stream: Resource<InputStream>,
593599
len: u64,
594600
) -> anyhow::Result<Result<(Vec<u8>, streams::StreamStatus), ()>> {
595-
in_tokio(async { AsyncHost::read(self, stream, len).await }).map(xform)
601+
in_tokio(async { AsyncHostInputpStream::read(self, stream, len).await }).map(xform)
596602
}
597603

598604
fn blocking_read(
599605
&mut self,
600606
stream: Resource<InputStream>,
601607
len: u64,
602608
) -> anyhow::Result<Result<(Vec<u8>, streams::StreamStatus), ()>> {
603-
in_tokio(async { AsyncHost::blocking_read(self, stream, len).await }).map(xform)
609+
in_tokio(async { AsyncHostInputpStream::blocking_read(self, stream, len).await })
610+
.map(xform)
604611
}
605612

606613
fn skip(
607614
&mut self,
608615
stream: Resource<InputStream>,
609616
len: u64,
610617
) -> anyhow::Result<Result<(u64, streams::StreamStatus), ()>> {
611-
in_tokio(async { AsyncHost::skip(self, stream, len).await }).map(xform)
618+
in_tokio(async { AsyncHostInputpStream::skip(self, stream, len).await }).map(xform)
612619
}
613620

614621
fn blocking_skip(
615622
&mut self,
616623
stream: Resource<InputStream>,
617624
len: u64,
618625
) -> anyhow::Result<Result<(u64, streams::StreamStatus), ()>> {
619-
in_tokio(async { AsyncHost::blocking_skip(self, stream, len).await }).map(xform)
626+
in_tokio(async { AsyncHostInputpStream::blocking_skip(self, stream, len).await })
627+
.map(xform)
620628
}
621629

622630
fn subscribe(
623631
&mut self,
624632
stream: Resource<InputStream>,
625633
) -> anyhow::Result<Resource<Pollable>> {
626-
AsyncHost::subscribe_to_input_stream(self, stream)
634+
AsyncHostInputStream::subscribe(self, stream)
627635
}
628636
}
629637
}

crates/wasi/src/preview2/poll.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<T: WasiView> crate::preview2::bindings::io::poll::HostPollable for T {
199199

200200
pub mod sync {
201201
use crate::preview2::{
202-
bindings::io::poll::Host as AsyncHost,
202+
bindings::io::poll::HostPollable as AsyncHostPollable,
203203
bindings::sync_io::io::poll::{self, Pollable},
204204
in_tokio, WasiView,
205205
};
@@ -218,7 +218,7 @@ pub mod sync {
218218

219219
impl<T: WasiView> crate::preview2::bindings::sync_io::io::poll::HostPollable for T {
220220
fn drop(&mut self, pollable: Resource<Pollable>) -> Result<()> {
221-
AsyncHost::drop(self, pollable)
221+
AsyncHostPollable::drop(self, pollable)
222222
}
223223
}
224224
}

crates/wasi/src/preview2/preview1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ impl<
16341634
for (entry, d_next) in self
16351635
.table_mut()
16361636
// remove iterator from table and use it directly:
1637-
.delete_readdir(stream)?
1637+
.delete_readdir(stream.rep())?
16381638
.into_iter()
16391639
.zip(3u64..)
16401640
{

0 commit comments

Comments
 (0)