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

felipecrv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 15e161e36 refactor(rust/core)!: move the driver_manager feature to the 
new adbc_driver_manager package (#3197)
15e161e36 is described below

commit 15e161e3657563f0c49decd0b3eefa30ed6673e8
Author: eitsupi <[email protected]>
AuthorDate: Wed Aug 6 02:50:16 2025 +0900

    refactor(rust/core)!: move the driver_manager feature to the new 
adbc_driver_manager package (#3197)
    
    Part of #3106
    
    Remove the `driver_manager` feature of adbc_core and adding a new
    adbc_driver_manager package instead.
    
    Crates that depended on the `driver_manager` feature, such as
    adbc_snowflake, will need to be updated to include adbc_driver_manager
    as a dependency.
    
    ---------
    
    Co-authored-by: David Li <[email protected]>
---
 rust/Cargo.lock                                    |  25 +++--
 rust/Cargo.toml                                    |   3 +-
 rust/core/Cargo.toml                               |  22 +---
 rust/core/src/ffi/methods.rs                       |   3 +-
 rust/core/src/ffi/mod.rs                           |   6 +-
 rust/core/src/ffi/types.rs                         | 115 +++++++++++----------
 rust/core/src/lib.rs                               |   2 -
 rust/driver/datafusion/Cargo.toml                  |   2 +-
 rust/driver/dummy/Cargo.toml                       |   3 +-
 rust/driver/dummy/tests/driver_exporter_dummy.rs   |   4 +-
 rust/driver/snowflake/Cargo.toml                   |   3 +-
 rust/driver/snowflake/src/connection.rs            |   2 +-
 rust/driver/snowflake/src/database.rs              |   2 +-
 rust/driver/snowflake/src/driver.rs                |   2 +-
 rust/driver/snowflake/src/statement.rs             |   2 +-
 rust/{core => driver_manager}/Cargo.toml           |  37 +++----
 .../src/ffi/mod.rs => driver_manager/src/error.rs} |  18 ++--
 .../src/lib.rs}                                    |  49 ++++-----
 rust/{core => driver_manager}/tests/common/mod.rs  |   4 +-
 .../tests/driver_manager_sqlite.rs                 |   2 +-
 20 files changed, 148 insertions(+), 158 deletions(-)

diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index bf202a308..91efa8c15 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -8,13 +8,6 @@ version = "0.20.0"
 dependencies = [
  "arrow-array",
  "arrow-schema",
- "arrow-select",
- "libloading",
- "temp-env",
- "tempfile",
- "toml",
- "windows-registry",
- "windows-sys 0.60.2",
 ]
 
 [[package]]
@@ -32,11 +25,28 @@ dependencies = [
  "tokio",
 ]
 
+[[package]]
+name = "adbc_driver_manager"
+version = "0.20.0"
+dependencies = [
+ "adbc_core",
+ "arrow-array",
+ "arrow-schema",
+ "arrow-select",
+ "libloading",
+ "temp-env",
+ "tempfile",
+ "toml",
+ "windows-registry",
+ "windows-sys 0.59.0",
+]
+
 [[package]]
 name = "adbc_dummy"
 version = "0.20.0"
 dependencies = [
  "adbc_core",
+ "adbc_driver_manager",
  "arrow-array",
  "arrow-buffer",
  "arrow-schema",
@@ -48,6 +58,7 @@ name = "adbc_snowflake"
 version = "0.20.0"
 dependencies = [
  "adbc_core",
+ "adbc_driver_manager",
  "arrow-array",
  "arrow-schema",
  "dotenvy",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 722208338..5cdb699ab 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -16,7 +16,7 @@
 # under the License.
 
 [workspace]
-members = ["core", "driver/*"]
+members = ["core", "driver_manager", "driver/*"]
 resolver = "2"
 
 [workspace.package]
@@ -35,6 +35,7 @@ categories = ["database"]
 
 [workspace.dependencies]
 adbc_core = { path = "./core", version = "0.20.0" }
+adbc_driver_manager = { path = "./driver_manager", version = "0.20.0" }
 arrow-array = { version = ">=53.1.0, <57", default-features = false, features 
= [
     "ffi",
 ] }
diff --git a/rust/core/Cargo.toml b/rust/core/Cargo.toml
index ee0bd5551..717c08b35 100644
--- a/rust/core/Cargo.toml
+++ b/rust/core/Cargo.toml
@@ -25,37 +25,17 @@ homepage.workspace = true
 keywords.workspace = true
 license.workspace = true
 name = "adbc_core"
-readme = "../README.md"
+readme.workspace = true
 repository.workspace = true
 rust-version.workspace = true
 version.workspace = true
 
 [features]
 default = []
-driver_manager = ["dep:toml", "dep:libloading", "dep:windows-sys", 
"dep:windows-registry"]
-driver_manager_test_lib = ["driver_manager"]
-driver_manager_test_manifest_user = ["driver_manager_test_lib"]
 
 [dependencies]
 arrow-array.workspace = true
 arrow-schema.workspace = true
-libloading = {version = "0.8", optional = true}
-toml = { version = "0.9.2", default-features = false, features = [
-    "parse", "display"
-], optional = true }
-
-[dev-dependencies]
-temp-env = "0.3"
-arrow-select.workspace = true
-tempfile = "3.20.0"
 
 [package.metadata.docs.rs]
 all-features = true
-
-[target.'cfg(windows)'.dependencies]
-windows-sys = {version = ">= 0.59.0", features = [
-    "Win32_UI_Shell",
-    "Win32_Globalization",
-    "Win32_System_Com",
-], optional = true}
-windows-registry = {version = ">= 0.5.3", optional = true}
diff --git a/rust/core/src/ffi/methods.rs b/rust/core/src/ffi/methods.rs
index e4be57965..4fd4feeea 100644
--- a/rust/core/src/ffi/methods.rs
+++ b/rust/core/src/ffi/methods.rs
@@ -32,7 +32,8 @@ macro_rules! method {
         #[allow(dead_code)]
         pub(crate) type $type_name = unsafe extern "C" fn($( $arg ),*) -> 
$return_type;
         #[allow(dead_code)]
-        pub(crate) unsafe extern "C" fn $func_name($(_:$arg),*) -> 
$return_type {
+        #[doc(hidden)]
+        pub unsafe extern "C" fn $func_name($(_:$arg),*) -> $return_type {
             $return_value
         }
     };
diff --git a/rust/core/src/ffi/mod.rs b/rust/core/src/ffi/mod.rs
index 89acee75a..cbf04cce6 100644
--- a/rust/core/src/ffi/mod.rs
+++ b/rust/core/src/ffi/mod.rs
@@ -18,9 +18,9 @@
 //! C-compatible items as defined in 
[`adbc.h`](https://github.com/apache/arrow-adbc/blob/main/c/include/arrow-adbc/adbc.h)
 
 pub mod constants;
-pub(crate) mod methods;
+pub mod methods;
 pub(crate) mod types;
 pub use types::{
-    FFI_AdbcConnection, FFI_AdbcDatabase, FFI_AdbcDriver, 
FFI_AdbcDriverInitFunc, FFI_AdbcError,
-    FFI_AdbcErrorDetail, FFI_AdbcPartitions, FFI_AdbcStatement, 
FFI_AdbcStatusCode,
+    driver_method, FFI_AdbcConnection, FFI_AdbcDatabase, FFI_AdbcDriver, 
FFI_AdbcDriverInitFunc,
+    FFI_AdbcError, FFI_AdbcErrorDetail, FFI_AdbcPartitions, FFI_AdbcStatement, 
FFI_AdbcStatusCode,
 };
diff --git a/rust/core/src/ffi/types.rs b/rust/core/src/ffi/types.rs
index b1b5d35b0..92a40a59e 100644
--- a/rust/core/src/ffi/types.rs
+++ b/rust/core/src/ffi/types.rs
@@ -136,61 +136,61 @@ pub struct FFI_AdbcDriver {
     pub(crate) release: Option<
         unsafe extern "C" fn(driver: *mut Self, error: *mut FFI_AdbcError) -> 
FFI_AdbcStatusCode,
     >,
-    pub(crate) DatabaseInit: Option<methods::FuncDatabaseInit>,
-    pub(crate) DatabaseNew: Option<methods::FuncDatabaseNew>,
-    pub(crate) DatabaseSetOption: Option<methods::FuncDatabaseSetOption>,
-    pub(crate) DatabaseRelease: Option<methods::FuncDatabaseRelease>,
-    pub(crate) ConnectionCommit: Option<methods::FuncConnectionCommit>,
-    pub(crate) ConnectionGetInfo: Option<methods::FuncConnectionGetInfo>,
-    pub(crate) ConnectionGetObjects: Option<methods::FuncConnectionGetObjects>,
-    pub(crate) ConnectionGetTableSchema: 
Option<methods::FuncConnectionGetTableSchema>,
-    pub(crate) ConnectionGetTableTypes: 
Option<methods::FuncConnectionGetTableTypes>,
-    pub(crate) ConnectionInit: Option<methods::FuncConnectionInit>,
-    pub(crate) ConnectionNew: Option<methods::FuncConnectionNew>,
-    pub(crate) ConnectionSetOption: Option<methods::FuncConnectionSetOption>,
-    pub(crate) ConnectionReadPartition: 
Option<methods::FuncConnectionReadPartition>,
-    pub(crate) ConnectionRelease: Option<methods::FuncConnectionRelease>,
-    pub(crate) ConnectionRollback: Option<methods::FuncConnectionRollback>,
-    pub(crate) StatementBind: Option<methods::FuncStatementBind>,
-    pub(crate) StatementBindStream: Option<methods::FuncStatementBindStream>,
-    pub(crate) StatementExecuteQuery: 
Option<methods::FuncStatementExecuteQuery>,
-    pub(crate) StatementExecutePartitions: 
Option<methods::FuncStatementExecutePartitions>,
-    pub(crate) StatementGetParameterSchema: 
Option<methods::FuncStatementGetParameterSchema>,
-    pub(crate) StatementNew: Option<methods::FuncStatementNew>,
-    pub(crate) StatementPrepare: Option<methods::FuncStatementPrepare>,
-    pub(crate) StatementRelease: Option<methods::FuncStatementRelease>,
-    pub(crate) StatementSetOption: Option<methods::FuncStatementSetOption>,
-    pub(crate) StatementSetSqlQuery: Option<methods::FuncStatementSetSqlQuery>,
-    pub(crate) StatementSetSubstraitPlan: 
Option<methods::FuncStatementSetSubstraitPlan>,
-    pub(crate) ErrorGetDetailCount: Option<methods::FuncErrorGetDetailCount>,
-    pub(crate) ErrorGetDetail: Option<methods::FuncErrorGetDetail>,
-    pub(crate) ErrorFromArrayStream: Option<methods::FuncErrorFromArrayStream>,
-    pub(crate) DatabaseGetOption: Option<methods::FuncDatabaseGetOption>,
-    pub(crate) DatabaseGetOptionBytes: 
Option<methods::FuncDatabaseGetOptionBytes>,
-    pub(crate) DatabaseGetOptionDouble: 
Option<methods::FuncDatabaseGetOptionDouble>,
-    pub(crate) DatabaseGetOptionInt: Option<methods::FuncDatabaseGetOptionInt>,
-    pub(crate) DatabaseSetOptionBytes: 
Option<methods::FuncDatabaseSetOptionBytes>,
-    pub(crate) DatabaseSetOptionDouble: 
Option<methods::FuncDatabaseSetOptionDouble>,
-    pub(crate) DatabaseSetOptionInt: Option<methods::FuncDatabaseSetOptionInt>,
-    pub(crate) ConnectionCancel: Option<methods::FuncConnectionCancel>,
-    pub(crate) ConnectionGetOption: Option<methods::FuncConnectionGetOption>,
-    pub(crate) ConnectionGetOptionBytes: 
Option<methods::FuncConnectionGetOptionBytes>,
-    pub(crate) ConnectionGetOptionDouble: 
Option<methods::FuncConnectionGetOptionDouble>,
-    pub(crate) ConnectionGetOptionInt: 
Option<methods::FuncConnectionGetOptionInt>,
-    pub(crate) ConnectionGetStatistics: 
Option<methods::FuncConnectionGetStatistics>,
-    pub(crate) ConnectionGetStatisticNames: 
Option<methods::FuncConnectionGetStatisticNames>,
-    pub(crate) ConnectionSetOptionBytes: 
Option<methods::FuncConnectionSetOptionBytes>,
-    pub(crate) ConnectionSetOptionDouble: 
Option<methods::FuncConnectionSetOptionDouble>,
-    pub(crate) ConnectionSetOptionInt: 
Option<methods::FuncConnectionSetOptionInt>,
-    pub(crate) StatementCancel: Option<methods::FuncStatementCancel>,
-    pub(crate) StatementExecuteSchema: 
Option<methods::FuncStatementExecuteSchema>,
-    pub(crate) StatementGetOption: Option<methods::FuncStatementGetOption>,
-    pub(crate) StatementGetOptionBytes: 
Option<methods::FuncStatementGetOptionBytes>,
-    pub(crate) StatementGetOptionDouble: 
Option<methods::FuncStatementGetOptionDouble>,
-    pub(crate) StatementGetOptionInt: 
Option<methods::FuncStatementGetOptionInt>,
-    pub(crate) StatementSetOptionBytes: 
Option<methods::FuncStatementSetOptionBytes>,
-    pub(crate) StatementSetOptionDouble: 
Option<methods::FuncStatementSetOptionDouble>,
-    pub(crate) StatementSetOptionInt: 
Option<methods::FuncStatementSetOptionInt>,
+    pub DatabaseInit: Option<methods::FuncDatabaseInit>,
+    pub DatabaseNew: Option<methods::FuncDatabaseNew>,
+    pub DatabaseSetOption: Option<methods::FuncDatabaseSetOption>,
+    pub DatabaseRelease: Option<methods::FuncDatabaseRelease>,
+    pub ConnectionCommit: Option<methods::FuncConnectionCommit>,
+    pub ConnectionGetInfo: Option<methods::FuncConnectionGetInfo>,
+    pub ConnectionGetObjects: Option<methods::FuncConnectionGetObjects>,
+    pub ConnectionGetTableSchema: 
Option<methods::FuncConnectionGetTableSchema>,
+    pub ConnectionGetTableTypes: Option<methods::FuncConnectionGetTableTypes>,
+    pub ConnectionInit: Option<methods::FuncConnectionInit>,
+    pub ConnectionNew: Option<methods::FuncConnectionNew>,
+    pub ConnectionSetOption: Option<methods::FuncConnectionSetOption>,
+    pub ConnectionReadPartition: Option<methods::FuncConnectionReadPartition>,
+    pub ConnectionRelease: Option<methods::FuncConnectionRelease>,
+    pub ConnectionRollback: Option<methods::FuncConnectionRollback>,
+    pub StatementBind: Option<methods::FuncStatementBind>,
+    pub StatementBindStream: Option<methods::FuncStatementBindStream>,
+    pub StatementExecuteQuery: Option<methods::FuncStatementExecuteQuery>,
+    pub StatementExecutePartitions: 
Option<methods::FuncStatementExecutePartitions>,
+    pub StatementGetParameterSchema: 
Option<methods::FuncStatementGetParameterSchema>,
+    pub StatementNew: Option<methods::FuncStatementNew>,
+    pub StatementPrepare: Option<methods::FuncStatementPrepare>,
+    pub StatementRelease: Option<methods::FuncStatementRelease>,
+    pub StatementSetOption: Option<methods::FuncStatementSetOption>,
+    pub StatementSetSqlQuery: Option<methods::FuncStatementSetSqlQuery>,
+    pub StatementSetSubstraitPlan: 
Option<methods::FuncStatementSetSubstraitPlan>,
+    pub ErrorGetDetailCount: Option<methods::FuncErrorGetDetailCount>,
+    pub ErrorGetDetail: Option<methods::FuncErrorGetDetail>,
+    pub ErrorFromArrayStream: Option<methods::FuncErrorFromArrayStream>,
+    pub DatabaseGetOption: Option<methods::FuncDatabaseGetOption>,
+    pub DatabaseGetOptionBytes: Option<methods::FuncDatabaseGetOptionBytes>,
+    pub DatabaseGetOptionDouble: Option<methods::FuncDatabaseGetOptionDouble>,
+    pub DatabaseGetOptionInt: Option<methods::FuncDatabaseGetOptionInt>,
+    pub DatabaseSetOptionBytes: Option<methods::FuncDatabaseSetOptionBytes>,
+    pub DatabaseSetOptionDouble: Option<methods::FuncDatabaseSetOptionDouble>,
+    pub DatabaseSetOptionInt: Option<methods::FuncDatabaseSetOptionInt>,
+    pub ConnectionCancel: Option<methods::FuncConnectionCancel>,
+    pub ConnectionGetOption: Option<methods::FuncConnectionGetOption>,
+    pub ConnectionGetOptionBytes: 
Option<methods::FuncConnectionGetOptionBytes>,
+    pub ConnectionGetOptionDouble: 
Option<methods::FuncConnectionGetOptionDouble>,
+    pub ConnectionGetOptionInt: Option<methods::FuncConnectionGetOptionInt>,
+    pub ConnectionGetStatistics: Option<methods::FuncConnectionGetStatistics>,
+    pub ConnectionGetStatisticNames: 
Option<methods::FuncConnectionGetStatisticNames>,
+    pub ConnectionSetOptionBytes: 
Option<methods::FuncConnectionSetOptionBytes>,
+    pub ConnectionSetOptionDouble: 
Option<methods::FuncConnectionSetOptionDouble>,
+    pub ConnectionSetOptionInt: Option<methods::FuncConnectionSetOptionInt>,
+    pub StatementCancel: Option<methods::FuncStatementCancel>,
+    pub StatementExecuteSchema: Option<methods::FuncStatementExecuteSchema>,
+    pub StatementGetOption: Option<methods::FuncStatementGetOption>,
+    pub StatementGetOptionBytes: Option<methods::FuncStatementGetOptionBytes>,
+    pub StatementGetOptionDouble: 
Option<methods::FuncStatementGetOptionDouble>,
+    pub StatementGetOptionInt: Option<methods::FuncStatementGetOptionInt>,
+    pub StatementSetOptionBytes: Option<methods::FuncStatementSetOptionBytes>,
+    pub StatementSetOptionDouble: 
Option<methods::FuncStatementSetOptionDouble>,
+    pub StatementSetOptionInt: Option<methods::FuncStatementSetOptionInt>,
 }
 
 /// The [FFI_AdbcDriver] carries raw C pointers to the driver manager and 
private data that rustc
@@ -198,13 +198,14 @@ pub struct FFI_AdbcDriver {
 unsafe impl Send for FFI_AdbcDriver {}
 unsafe impl Sync for FFI_AdbcDriver {}
 
+#[macro_export]
 macro_rules! driver_method {
     ($driver:expr, $method:ident) => {
-        $driver.$method.unwrap_or(crate::ffi::methods::$method)
+        $driver.$method.unwrap_or($crate::ffi::methods::$method)
     };
 }
 
-pub(crate) use driver_method;
+pub use driver_method;
 
 impl TryFrom<FFI_AdbcStatusCode> for Status {
     type Error = Error;
diff --git a/rust/core/src/lib.rs b/rust/core/src/lib.rs
index b50ebe464..d565bef9c 100644
--- a/rust/core/src/lib.rs
+++ b/rust/core/src/lib.rs
@@ -61,8 +61,6 @@
 mod driver_exporter;
 #[doc(hidden)]
 pub use driver_exporter::FFIDriver;
-#[cfg(feature = "driver_manager")]
-pub mod driver_manager;
 pub mod error;
 pub mod ffi;
 pub mod options;
diff --git a/rust/driver/datafusion/Cargo.toml 
b/rust/driver/datafusion/Cargo.toml
index c6a16a102..d19c589b3 100644
--- a/rust/driver/datafusion/Cargo.toml
+++ b/rust/driver/datafusion/Cargo.toml
@@ -48,4 +48,4 @@ crate-type = ["lib", "cdylib"]
 
 [features]
 default = []
-ffi = ["adbc_core/driver_manager"]
+ffi = []
diff --git a/rust/driver/dummy/Cargo.toml b/rust/driver/dummy/Cargo.toml
index e63637dab..deace25b8 100644
--- a/rust/driver/dummy/Cargo.toml
+++ b/rust/driver/dummy/Cargo.toml
@@ -25,7 +25,8 @@ license.workspace = true
 publish = false
 
 [dependencies]
-adbc_core = { path = "../../core" }
+adbc_core.workspace = true
+adbc_driver_manager.workspace = true
 arrow-array.workspace = true
 arrow-buffer.workspace = true
 arrow-schema.workspace = true
diff --git a/rust/driver/dummy/tests/driver_exporter_dummy.rs 
b/rust/driver/dummy/tests/driver_exporter_dummy.rs
index 611890ba2..a5869c055 100644
--- a/rust/driver/dummy/tests/driver_exporter_dummy.rs
+++ b/rust/driver/dummy/tests/driver_exporter_dummy.rs
@@ -26,15 +26,13 @@ use arrow_array::{Array, Float64Array, Int64Array, 
RecordBatch, RecordBatchReade
 use arrow_schema::{DataType, Field, Schema};
 use arrow_select::concat::concat_batches;
 
-use adbc_core::driver_manager::{
-    ManagedConnection, ManagedDatabase, ManagedDriver, ManagedStatement,
-};
 use adbc_core::options::{
     AdbcVersion, InfoCode, IngestMode, IsolationLevel, ObjectDepth, 
OptionConnection,
     OptionDatabase, OptionStatement,
 };
 use adbc_core::Statement;
 use adbc_core::{schemas, Connection, Database, Driver, Optionable};
+use adbc_driver_manager::{ManagedConnection, ManagedDatabase, ManagedDriver, 
ManagedStatement};
 
 use adbc_dummy::{DummyConnection, DummyDatabase, DummyDriver, DummyStatement, 
SingleBatchReader};
 
diff --git a/rust/driver/snowflake/Cargo.toml b/rust/driver/snowflake/Cargo.toml
index f6847fcb3..3b9f30793 100644
--- a/rust/driver/snowflake/Cargo.toml
+++ b/rust/driver/snowflake/Cargo.toml
@@ -42,7 +42,8 @@ env = ["dep:regex"]
 dotenv = ["env", "dep:dotenvy"]
 
 [dependencies]
-adbc_core = { workspace = true, features = ["driver_manager"] }
+adbc_core.workspace = true
+adbc_driver_manager.workspace = true
 arrow-array.workspace = true
 arrow-schema.workspace = true
 dotenvy = { version = "0.15.7", default-features = false, optional = true }
diff --git a/rust/driver/snowflake/src/connection.rs 
b/rust/driver/snowflake/src/connection.rs
index 222cf3b01..cc0ba51d9 100644
--- a/rust/driver/snowflake/src/connection.rs
+++ b/rust/driver/snowflake/src/connection.rs
@@ -22,11 +22,11 @@
 use std::collections::HashSet;
 
 use adbc_core::{
-    driver_manager::ManagedConnection,
     error::Result,
     options::{InfoCode, OptionConnection, OptionValue},
     Optionable,
 };
+use adbc_driver_manager::ManagedConnection;
 use arrow_array::RecordBatchReader;
 use arrow_schema::Schema;
 
diff --git a/rust/driver/snowflake/src/database.rs 
b/rust/driver/snowflake/src/database.rs
index 492933962..48715a78e 100644
--- a/rust/driver/snowflake/src/database.rs
+++ b/rust/driver/snowflake/src/database.rs
@@ -22,11 +22,11 @@
 use std::{collections::HashSet, ffi::c_int, sync::Arc};
 
 use adbc_core::{
-    driver_manager::ManagedDatabase,
     error::{Error, Result, Status},
     options::{AdbcVersion, InfoCode, OptionConnection, OptionDatabase, 
OptionValue},
     Connection as _, Database as _, Optionable,
 };
+use adbc_driver_manager::ManagedDatabase;
 use arrow_array::{
     cast::AsArray,
     types::{Int64Type, UInt32Type},
diff --git a/rust/driver/snowflake/src/driver.rs 
b/rust/driver/snowflake/src/driver.rs
index e355d3f9c..91bec5ffc 100644
--- a/rust/driver/snowflake/src/driver.rs
+++ b/rust/driver/snowflake/src/driver.rs
@@ -26,10 +26,10 @@ use std::{fmt, sync::LazyLock};
 #[cfg(any(feature = "bundled", feature = "linked"))]
 use adbc_core::ffi::{FFI_AdbcDriverInitFunc, FFI_AdbcError, 
FFI_AdbcStatusCode};
 use adbc_core::{
-    driver_manager::ManagedDriver,
     error::Result,
     options::{AdbcVersion, OptionDatabase, OptionValue},
 };
+use adbc_driver_manager::ManagedDriver;
 
 use crate::Database;
 
diff --git a/rust/driver/snowflake/src/statement.rs 
b/rust/driver/snowflake/src/statement.rs
index 34b83f09b..eb41d1108 100644
--- a/rust/driver/snowflake/src/statement.rs
+++ b/rust/driver/snowflake/src/statement.rs
@@ -20,11 +20,11 @@
 //!
 
 use adbc_core::{
-    driver_manager::ManagedStatement,
     error::Result,
     options::{OptionStatement, OptionValue},
     Optionable, PartitionedResult,
 };
+use adbc_driver_manager::ManagedStatement;
 use arrow_array::{RecordBatch, RecordBatchReader};
 use arrow_schema::Schema;
 
diff --git a/rust/core/Cargo.toml b/rust/driver_manager/Cargo.toml
similarity index 73%
copy from rust/core/Cargo.toml
copy to rust/driver_manager/Cargo.toml
index ee0bd5551..396dea47b 100644
--- a/rust/core/Cargo.toml
+++ b/rust/driver_manager/Cargo.toml
@@ -18,44 +18,41 @@
 [package]
 authors.workspace = true
 categories.workspace = true
-description = "Public abstract API, driver manager and driver exporter"
+description = "ADBC driver manager"
 documentation.workspace = true
 edition.workspace = true
 homepage.workspace = true
 keywords.workspace = true
 license.workspace = true
-name = "adbc_core"
-readme = "../README.md"
+name = "adbc_driver_manager"
+readme.workspace = true
 repository.workspace = true
 rust-version.workspace = true
 version.workspace = true
 
 [features]
-default = []
-driver_manager = ["dep:toml", "dep:libloading", "dep:windows-sys", 
"dep:windows-registry"]
-driver_manager_test_lib = ["driver_manager"]
+driver_manager_test_lib = []
 driver_manager_test_manifest_user = ["driver_manager_test_lib"]
 
 [dependencies]
+adbc_core.workspace = true
 arrow-array.workspace = true
 arrow-schema.workspace = true
-libloading = {version = "0.8", optional = true}
+libloading = "0.8"
 toml = { version = "0.9.2", default-features = false, features = [
-    "parse", "display"
-], optional = true }
-
-[dev-dependencies]
-temp-env = "0.3"
-arrow-select.workspace = true
-tempfile = "3.20.0"
-
-[package.metadata.docs.rs]
-all-features = true
+    "parse",
+    "display",
+] }
 
 [target.'cfg(windows)'.dependencies]
-windows-sys = {version = ">= 0.59.0", features = [
+windows-sys = { version = ">= 0.59.0", features = [
     "Win32_UI_Shell",
     "Win32_Globalization",
     "Win32_System_Com",
-], optional = true}
-windows-registry = {version = ">= 0.5.3", optional = true}
+], optional = true }
+windows-registry = { version = ">= 0.5.3", optional = true }
+
+[dev-dependencies]
+arrow-select.workspace = true
+temp-env = "0.3"
+tempfile = "3.20"
diff --git a/rust/core/src/ffi/mod.rs b/rust/driver_manager/src/error.rs
similarity index 67%
copy from rust/core/src/ffi/mod.rs
copy to rust/driver_manager/src/error.rs
index 89acee75a..de1afda77 100644
--- a/rust/core/src/ffi/mod.rs
+++ b/rust/driver_manager/src/error.rs
@@ -15,12 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! C-compatible items as defined in 
[`adbc.h`](https://github.com/apache/arrow-adbc/blob/main/c/include/arrow-adbc/adbc.h)
+use adbc_core::error::Status;
 
-pub mod constants;
-pub(crate) mod methods;
-pub(crate) mod types;
-pub use types::{
-    FFI_AdbcConnection, FFI_AdbcDatabase, FFI_AdbcDriver, 
FFI_AdbcDriverInitFunc, FFI_AdbcError,
-    FFI_AdbcErrorDetail, FFI_AdbcPartitions, FFI_AdbcStatement, 
FFI_AdbcStatusCode,
-};
+pub(crate) fn libloading_error_to_adbc_error(e: libloading::Error) -> 
adbc_core::error::Error {
+    adbc_core::error::Error {
+        message: format!("Error with dynamic library: {e}"),
+        status: Status::Internal,
+        vendor_code: 0,
+        sqlstate: [0; 5],
+        details: None,
+    }
+}
diff --git a/rust/core/src/driver_manager.rs b/rust/driver_manager/src/lib.rs
similarity index 98%
rename from rust/core/src/driver_manager.rs
rename to rust/driver_manager/src/lib.rs
index fb1544dd5..f7c119431 100644
--- a/rust/core/src/driver_manager.rs
+++ b/rust/driver_manager/src/lib.rs
@@ -49,10 +49,10 @@
 //! # use arrow_schema::{Field, Schema, DataType};
 //! # use arrow_select::concat::concat_batches;
 //! # use adbc_core::{
-//! #     driver_manager::ManagedDriver,
 //! #     options::{AdbcVersion, OptionDatabase, OptionStatement},
 //! #     Connection, Database, Driver, Statement, Optionable
 //! # };
+//! # use adbc_driver_manager::ManagedDriver;
 //! # fn main() -> Result<(), Box<dyn std::error::Error>> {
 //! let opts = [(OptionDatabase::Uri, ":memory:".into())];
 //! let mut driver = 
ManagedDriver::load_dynamic_from_name("adbc_driver_sqlite", None, 
AdbcVersion::V100)?;
@@ -100,6 +100,8 @@
 // an immutable struct of function pointers. Wrapping the driver in a `Mutex`
 // would prevent any parallelism between driver calls, which is not desirable.
 
+pub mod error;
+
 use std::collections::HashSet;
 use std::env;
 use std::ffi::{CStr, CString, OsStr};
@@ -111,22 +113,21 @@ use std::pin::Pin;
 use std::ptr::{null, null_mut};
 use std::sync::{Arc, Mutex};
 
-#[cfg(target_os = "windows")]
-use windows_registry;
-
 use arrow_array::ffi::{to_ffi, FFI_ArrowSchema};
 use arrow_array::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
 use arrow_array::{Array, RecordBatch, RecordBatchReader, StructArray};
 use toml::de::DeTable;
 
-use crate::{
-    error::{Error, Status},
+use adbc_core::{
+    error::{Error, Result, Status},
     options::{self, AdbcVersion, InfoCode, OptionValue},
-    LoadFlags, PartitionedResult, Result, LOAD_FLAG_ALLOW_RELATIVE_PATHS, 
LOAD_FLAG_SEARCH_ENV,
+    LoadFlags, PartitionedResult, LOAD_FLAG_ALLOW_RELATIVE_PATHS, 
LOAD_FLAG_SEARCH_ENV,
     LOAD_FLAG_SEARCH_SYSTEM, LOAD_FLAG_SEARCH_USER,
 };
-use crate::{ffi, ffi::types::driver_method, Optionable};
-use crate::{Connection, Database, Driver, Statement};
+use adbc_core::{ffi, ffi::driver_method, Optionable};
+use adbc_core::{Connection, Database, Driver, Statement};
+
+use crate::error::libloading_error_to_adbc_error;
 
 const ERR_ONLY_STRING_OPT: &str = "Only string option value are supported with 
ADBC 1.0.0";
 const ERR_CANCEL_UNSUPPORTED: &str =
@@ -144,18 +145,6 @@ fn check_status(status: ffi::FFI_AdbcStatusCode, error: 
ffi::FFI_AdbcError) -> R
     }
 }
 
-impl From<libloading::Error> for Error {
-    fn from(value: libloading::Error) -> Self {
-        Self {
-            message: format!("Error with dynamic library: {value}"),
-            status: Status::Internal,
-            vendor_code: 0,
-            sqlstate: [0; 5],
-            details: None,
-        }
-    }
-}
-
 #[derive(Debug)]
 struct ManagedDriverInner {
     driver: ffi::FFI_AdbcDriver,
@@ -367,11 +356,14 @@ impl ManagedDriver {
         let default_entrypoint = get_default_entrypoint(filename.as_ref());
 
         let entrypoint = entrypoint.unwrap_or(default_entrypoint.as_bytes());
-        let library = unsafe { libloading::Library::new(filename.as_ref())? };
+        let library = unsafe {
+            
libloading::Library::new(filename.as_ref()).map_err(libloading_error_to_adbc_error)?
+        };
         let init: libloading::Symbol<ffi::FFI_AdbcDriverInitFunc> = unsafe {
             library
                 .get(entrypoint)
-                .or_else(|_| library.get(b"AdbcDriverInit"))?
+                .or_else(|_| library.get(b"AdbcDriverInit"))
+                .map_err(libloading_error_to_adbc_error)?
         };
         let driver = Self::load_impl(&init, version)?;
         let inner = Arc::pin(ManagedDriverInner {
@@ -690,6 +682,8 @@ fn set_option_database(
 ) -> Result<()> {
     let key = CString::new(key.as_ref())?;
     let mut error = ffi::FFI_AdbcError::with_driver(driver);
+    #[allow(unknown_lints)]
+    #[warn(non_exhaustive_omitted_patterns)]
     let status = match (version, value) {
         (_, OptionValue::String(value)) => {
             let value = CString::new(value)?;
@@ -720,6 +714,7 @@ fn set_option_database(
             ERR_ONLY_STRING_OPT,
             Status::NotImplemented,
         ))?,
+        (_, _) => unreachable!(),
     };
     check_status(status, error)
 }
@@ -979,6 +974,8 @@ fn set_option_connection(
 ) -> Result<()> {
     let key = CString::new(key.as_ref())?;
     let mut error = ffi::FFI_AdbcError::with_driver(driver);
+    #[allow(unknown_lints)]
+    #[warn(non_exhaustive_omitted_patterns)]
     let status = match (version, value) {
         (_, OptionValue::String(value)) => {
             let value = CString::new(value)?;
@@ -1009,6 +1006,7 @@ fn set_option_connection(
             ERR_ONLY_STRING_OPT,
             Status::NotImplemented,
         ))?,
+        (_, _) => unreachable!(),
     };
     check_status(status, error)
 }
@@ -1392,6 +1390,8 @@ fn set_option_statement(
 ) -> Result<()> {
     let key = CString::new(key.as_ref())?;
     let mut error = ffi::FFI_AdbcError::with_driver(driver);
+    #[allow(unknown_lints)]
+    #[warn(non_exhaustive_omitted_patterns)]
     let status = match (version, value) {
         (_, OptionValue::String(value)) => {
             let value = CString::new(value)?;
@@ -1422,6 +1422,7 @@ fn set_option_statement(
             ERR_ONLY_STRING_OPT,
             Status::NotImplemented,
         ))?,
+        (_, _) => unreachable!(),
     };
     check_status(status, error)
 }
@@ -1809,7 +1810,7 @@ const fn arch_triplet() -> (&'static str, &'static str, 
&'static str) {
 mod tests {
     use super::*;
 
-    use crate::LOAD_FLAG_DEFAULT;
+    use adbc_core::LOAD_FLAG_DEFAULT;
     use temp_env::{with_var, with_var_unset};
     use tempfile::Builder;
 
diff --git a/rust/core/tests/common/mod.rs 
b/rust/driver_manager/tests/common/mod.rs
similarity index 99%
rename from rust/core/tests/common/mod.rs
rename to rust/driver_manager/tests/common/mod.rs
index 7e06e5bfe..28df83f10 100644
--- a/rust/core/tests/common/mod.rs
+++ b/rust/driver_manager/tests/common/mod.rs
@@ -19,15 +19,13 @@ use std::collections::HashSet;
 use std::ops::Deref;
 use std::sync::Arc;
 
-use adbc_core::driver_manager::{
-    ManagedConnection, ManagedDatabase, ManagedDriver, ManagedStatement,
-};
 use adbc_core::error::Status;
 use adbc_core::options::{
     InfoCode, IngestMode, ObjectDepth, OptionConnection, OptionDatabase, 
OptionStatement,
 };
 use adbc_core::schemas;
 use adbc_core::{Connection, Database, Driver, Optionable, Statement};
+use adbc_driver_manager::{ManagedConnection, ManagedDatabase, ManagedDriver, 
ManagedStatement};
 
 use arrow_array::{
     cast::as_string_array, Array, Float64Array, Int64Array, RecordBatch, 
RecordBatchReader,
diff --git a/rust/core/tests/driver_manager_sqlite.rs 
b/rust/driver_manager/tests/driver_manager_sqlite.rs
similarity index 99%
rename from rust/core/tests/driver_manager_sqlite.rs
rename to rust/driver_manager/tests/driver_manager_sqlite.rs
index 20075f836..8f9a654ab 100644
--- a/rust/core/tests/driver_manager_sqlite.rs
+++ b/rust/driver_manager/tests/driver_manager_sqlite.rs
@@ -17,10 +17,10 @@
 
 use arrow_schema::{Field, Schema};
 
-use adbc_core::driver_manager::{ManagedDatabase, ManagedDriver};
 use adbc_core::options::{AdbcVersion, OptionConnection, OptionDatabase};
 use adbc_core::{error::Status, Driver, Optionable};
 use adbc_core::{Connection, Database, Statement};
+use adbc_driver_manager::{ManagedDatabase, ManagedDriver};
 
 mod common;
 

Reply via email to