yutannihilation / savvy

A simple R extension interface using Rust

Home Page:https://yutannihilation.github.io/savvy/guide/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional Struct argument is not allowed

eitsupi opened this issue · comments

From eitsupi/r-glaredb#11

If a function having optional struct argument is created as shown below, it seems to cause an error if NULL is passed on the R side.

pub fn sql(query: &str, connection: Option<RGlareDbConnection>) -> savvy::Result<RGlareDbExecutionOutput> {
    if let Some(connection) = connection {
        connection.sql(query)
    } else {
        RGlareDbConnection::default_in_memory()?.sql(query)
    }
}
> sql("select 'hello'", NULL)
Error: Expected RGlareDbConnection, got NULL

Oh, thanks for catching!

Should be fixed now. Please update the dev version of savvy-cli and run savvy-cli update.

Wow, what a very quick update! Thanks.