diff options
author | Luca Casonato <hello@lcas.dev> | 2022-09-30 07:54:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 07:54:12 +0200 |
commit | 20c7300412bdb487fc758577d6256bbcf96efd12 (patch) | |
tree | 2dcd218a6095a2ad143fb27e304391b5fe64cf27 /core/resources.rs | |
parent | 38f544538b337074cbce317e67859a69bb23684c (diff) |
refactor(ext/http): remove op_http_read (#16096)
We can use Resource::read_return & op_read instead. This allows HTTP
request bodies to participate in FastStream.
To make this work, `readableStreamForRid` required a change to allow non
auto-closing resources to be handled. This required some minor changes
in our FastStream paths in ext/http and ext/flash.
Diffstat (limited to 'core/resources.rs')
-rw-r--r-- | core/resources.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/core/resources.rs b/core/resources.rs index eaa1fb3cf..56c9298af 100644 --- a/core/resources.rs +++ b/core/resources.rs @@ -35,14 +35,7 @@ pub trait Resource: Any + 'static { type_name::<Self>().into() } - /// Resources may implement `read()` to be a readable stream - fn read(self: Rc<Self>, buf: ZeroCopyBuf) -> AsyncResult<usize> { - Box::pin(async move { - let (nread, _) = self.read_return(buf).await?; - Ok(nread) - }) - } - + /// Resources may implement `read_return()` to be a readable stream fn read_return( self: Rc<Self>, _buf: ZeroCopyBuf, |