You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by ko...@apache.org on 2025/11/13 05:03:55 UTC

(opendal) branch remove-deprecated-via-map created (now ce72cc0c7)

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

koushiro pushed a change to branch remove-deprecated-via-map
in repository https://gitbox.apache.org/repos/asf/opendal.git


      at ce72cc0c7 chore(types): remove deprecated Operator::from_map and Operator::via_map

This branch includes the following new commits:

     new ce72cc0c7 chore(types): remove deprecated Operator::from_map and Operator::via_map

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(opendal) 01/01: chore(types): remove deprecated Operator::from_map and Operator::via_map

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

koushiro pushed a commit to branch remove-deprecated-via-map
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit ce72cc0c7c30b52065c8b1f29ed12a24527e85db
Author: koushiro <ko...@gmail.com>
AuthorDate: Thu Nov 13 13:03:42 2025 +0800

    chore(types): remove deprecated Operator::from_map and Operator::via_map
---
 core/src/types/operator/builder.rs | 66 +-------------------------------------
 integrations/unftp-sbe/src/lib.rs  |  2 +-
 2 files changed, 2 insertions(+), 66 deletions(-)

diff --git a/core/src/types/operator/builder.rs b/core/src/types/operator/builder.rs
index 60f1f8706..1954ea85d 100644
--- a/core/src/types/operator/builder.rs
+++ b/core/src/types/operator/builder.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::collections::HashMap;
 use std::sync::Arc;
 
 use crate::layers::*;
@@ -330,69 +329,6 @@ impl Operator {
         Ok(op)
     }
 
-    /// Create a new operator from given map.
-    ///
-    /// # Notes
-    ///
-    /// from_map is using static dispatch layers which is zero cost. via_map is
-    /// using dynamic dispatch layers which has a bit runtime overhead with an
-    /// extra vtable lookup and unable to inline. But from_map requires generic
-    /// type parameter which is not always easy to be used.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// # use anyhow::Result;
-    /// use std::collections::HashMap;
-    ///
-    /// use opendal::services::Memory;
-    /// use opendal::Operator;
-    /// async fn test() -> Result<()> {
-    ///     let map = HashMap::new();
-    ///
-    ///     // Build an `Operator` to start operating the storage.
-    ///     let op: Operator = Operator::from_map::<Memory>(map)?.finish();
-    ///
-    ///     Ok(())
-    /// }
-    /// ```
-    #[deprecated = "use from_iter instead"]
-    pub fn from_map<B: Builder>(
-        map: HashMap<String, String>,
-    ) -> Result<OperatorBuilder<impl Access>> {
-        Self::from_iter::<B>(map)
-    }
-
-    /// Create a new operator from given scheme and map.
-    ///
-    /// # Notes
-    ///
-    /// from_map is using static dispatch layers which is zero cost. via_map is
-    /// using dynamic dispatch layers which has a bit runtime overhead with an
-    /// extra vtable lookup and unable to inline. But from_map requires generic
-    /// type parameter which is not always easy to be used.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// # use anyhow::Result;
-    /// use std::collections::HashMap;
-    ///
-    /// use opendal::Operator;
-    /// async fn test() -> Result<()> {
-    ///     let map = HashMap::new();
-    ///
-    ///     // Build an `Operator` to start operating the storage.
-    ///     let op: Operator = Operator::via_map(opendal::services::MEMORY_SCHEME, map)?;
-    ///
-    ///     Ok(())
-    /// }
-    /// ```
-    #[deprecated = "use via_iter instead"]
-    pub fn via_map(scheme: impl AsRef<str>, map: HashMap<String, String>) -> Result<Operator> {
-        Self::via_iter(scheme, map)
-    }
-
     /// Create a new layer with dynamic dispatch.
     ///
     /// Please note that `Layer` can modify internal contexts such as `HttpClient`
@@ -459,7 +395,7 @@ impl Operator {
 /// use opendal::Result;
 ///
 /// fn init_service<B: Builder>(cfg: HashMap<String, String>) -> Result<Operator> {
-///     let op = Operator::from_map::<B>(cfg)?
+///     let op = Operator::from_iter::<B>(cfg)?
 ///         .layer(LoggingLayer::default())
 ///         .layer(RetryLayer::new())
 ///         .finish();
diff --git a/integrations/unftp-sbe/src/lib.rs b/integrations/unftp-sbe/src/lib.rs
index 9d21f7855..ba75050a5 100644
--- a/integrations/unftp-sbe/src/lib.rs
+++ b/integrations/unftp-sbe/src/lib.rs
@@ -32,7 +32,7 @@
 //! #[tokio::main]
 //! async fn main() -> Result<()> {
 //!     // Create any service desired
-//!     let op = opendal::Operator::from_map::<services::S3>(
+//!     let op = opendal::Operator::from_iter::<services::S3>(
 //!         [
 //!             ("bucket".to_string(), "my_bucket".to_string()),
 //!             ("access_key".to_string(), "my_access_key".to_string()),