You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/04/06 08:39:44 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1862: feat(core): Support move

Xuanwo commented on code in PR #1862:
URL: https://github.com/apache/incubator-opendal/pull/1862#discussion_r1159471729


##########
core/src/types/operator/operator.rs:
##########
@@ -603,6 +603,64 @@ impl Operator {
         Ok(())
     }
 
+    /// Move a file from `from` to `to`.
+    ///
+    /// # Notes
+    ///
+    /// - `from` and `to` must be a file.
+    /// - `to` will be overwritten if it exists.
+    /// - If `from` and `to` are the same, a `IsSameFile` error will occur.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # use std::io::Result;
+    /// # use opendal::Operator;
+    ///
+    /// # #[tokio::main]
+    /// # async fn test(op: Operator) -> Result<()> {
+    /// op.move_("path/to/file", "path/to/file2").await?;
+    /// # Ok(())
+    /// # }
+    /// ```
+    pub async fn move_(&self, from: &str, to: &str) -> Result<()> {

Review Comment:
   Oh, you are right. Let's use `rename`.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org