This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch refactor-write
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 0d26d0a47884db40211d45ef927bfebb37ac9c95
Author: Xuanwo <[email protected]>
AuthorDate: Thu Sep 7 23:56:02 2023 +0800

    Fix doc tests
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/types/operator/operator.rs | 8 ++++----
 core/src/types/writer.rs            | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/core/src/types/operator/operator.rs 
b/core/src/types/operator/operator.rs
index 1c8c6cd12..b51c2bc60 100644
--- a/core/src/types/operator/operator.rs
+++ b/core/src/types/operator/operator.rs
@@ -622,8 +622,8 @@ impl Operator {
     /// # #[tokio::main]
     /// # async fn test(op: Operator) -> Result<()> {
     /// let mut w = op.writer("path/to/file").await?;
-    /// w.write(&vec![0; 4096]).await?;
-    /// w.write(&vec![1; 4096]).await?;
+    /// w.write(vec![0; 4096]).await?;
+    /// w.write(vec![1; 4096]).await?;
     /// w.close().await?;
     /// # Ok(())
     /// # }
@@ -651,8 +651,8 @@ impl Operator {
     ///     .writer_with("path/to/file")
     ///     .content_type("application/octet-stream")
     ///     .await?;
-    /// w.write(&vec![0; 4096]).await?;
-    /// w.write(&vec![1; 4096]).await?;
+    /// w.write(vec![0; 4096]).await?;
+    /// w.write(vec![1; 4096]).await?;
     /// w.close().await?;
     /// # Ok(())
     /// # }
diff --git a/core/src/types/writer.rs b/core/src/types/writer.rs
index 40d862701..015595e0e 100644
--- a/core/src/types/writer.rs
+++ b/core/src/types/writer.rs
@@ -415,7 +415,8 @@ impl BlockingWriter {
     }
 
     /// Write into inner writer.
-    pub fn write(&mut self, mut bs: impl Buf) -> Result<()> {
+    pub fn write(&mut self, bs: impl Into<Bytes>) -> Result<()> {
+        let mut bs = bs.into();
         while bs.remaining() > 0 {
             let n = self.inner.write(&bs)?;
             bs.advance(n);

Reply via email to