From fde0c4b5093565d9382771c78635e3f20ca4de4c Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 09:10:38 +0100 Subject: [PATCH 1/3] Fix warning 'function ... should have a snake case name' --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8cfef70..49762fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,7 +86,7 @@ impl VTab for HelloVTab { } #[duckdb_entrypoint_c_api(ext_name = "rusty_quack", min_duckdb_version = "v0.0.1")] -pub unsafe fn ExtensionEntrypoint(con: Connection) -> Result<(), Box> { +pub unsafe fn extension_entrypoint(con: Connection) -> Result<(), Box> { con.register_table_function::("rusty_quack") .expect("Failed to register hello table function"); Ok(()) From 469b155f5d0243faa070115a969b221abc02c90a Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 09:12:28 +0100 Subject: [PATCH 2/3] Have package name be same as extension --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 171d707..3f38a6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1124,7 +1124,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] -name = "rusty-quack" +name = "rusty_quack" version = "0.1.0" dependencies = [ "duckdb", diff --git a/Cargo.toml b/Cargo.toml index ba88f86..ffb2655 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rusty-quack" +name = "rusty_quack" version = "0.1.0" edition = "2021" From 90c91f8abfa292a58a0af6443fbbd4ae49f5564a Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 09:19:58 +0100 Subject: [PATCH 3/3] Pass EXTENSION_NAME to rust code --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 49762fe..e32698f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,9 +85,11 @@ impl VTab for HelloVTab { } } +const EXTENSION_NAME: &str = env!("CARGO_PKG_NAME"); + #[duckdb_entrypoint_c_api(ext_name = "rusty_quack", min_duckdb_version = "v0.0.1")] pub unsafe fn extension_entrypoint(con: Connection) -> Result<(), Box> { - con.register_table_function::("rusty_quack") + con.register_table_function::(EXTENSION_NAME) .expect("Failed to register hello table function"); Ok(()) }