summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ops_builtin.rs2
-rw-r--r--core/resources.rs9
2 files changed, 2 insertions, 9 deletions
diff --git a/core/ops_builtin.rs b/core/ops_builtin.rs
index 02ecabc9c..6ca2a132c 100644
--- a/core/ops_builtin.rs
+++ b/core/ops_builtin.rs
@@ -165,7 +165,7 @@ async fn op_read(
buf: ZeroCopyBuf,
) -> Result<u32, Error> {
let resource = state.borrow().resource_table.get_any(rid)?;
- resource.read(buf).await.map(|n| n as u32)
+ resource.read_return(buf).await.map(|(n, _)| n as u32)
}
#[op]
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,