suyanhanx commented on code in PR #3021:
URL: 
https://github.com/apache/incubator-opendal/pull/3021#discussion_r1318887161


##########
core/src/raw/oio/buf.rs:
##########
@@ -0,0 +1,220 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use bytes::{Bytes, BytesMut};
+use std::{cmp, ptr};
+
+/// WriteBuf is used in [`oio::Write`] to provide a trait similar to 
[`bytes::Buf`].
+///
+/// The biggest difference is that `Buf`'s `copy_to_slice` and `copy_to_bytes` 
only needs `&self`
+/// instead of `&mut self`.
+pub trait WriteBuf: Send + Sync {
+    /// Returns the number of bytes between the current position and the end 
of the buffer.
+    ///
+    /// This value is greater than or equal to the length of the slice 
returned by chunk().
+    ///
+    /// # Notes
+    ///
+    /// Implementations of remaining should ensure that the return value does 
not change unless a
+    /// call is made to advance or any other function that is documented to 
change the Buf's
+    /// current position.
+    fn remaining(&self) -> usize;
+
+    /// Returns a slice starting at the current position and of length between 
0 and
+    /// Buf::remaining(). Note that this can return shorter slice (this allows 
non-continuous
+    /// internal representation).

Review Comment:
   No. I'm talking about this method, the `chunk`. Your comments says the slice 
returned could be shorter, how? I don't understand.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to