Releases: yutannihilation/savvy
Releases · yutannihilation/savvy
v0.4.1 (2024-03-30)
Release Notes
Breaking changes
Sexp
loses is_environment()
method becuase this isn't useful, considering
savvy doesn't support environment.
New features
-
get_dim()
and set_dim()
are now available also on Sexp
.
-
Now savvy allows to consume the value behind an external pointer. i.e., T
instead of &T
or &mut T
as the argument. After getting consumed, the
pointer is null, so any function call on the already-consumed R object results
in an error. See the guide for more details.
Example:
struct Value {};
struct Wrapper { inner: Value }
#[savvy]
impl Value {
fn new() -> Self {
Self {}
}
}
#[savvy]
impl Wrapper {
fn new(value: Value) -> Self {
Self { inner: value }
}
}
v <- Value$new()
w <- Wrapper$new(v) # value is consumed here.
w <- Wrapper$new(v)
#> Error: This external pointer is already consumed or deleted
-
Sexp
now has assert_integer()
etc to verify the type of the underlying
SEXP is as expected.
Download savvy-cli 0.4.1
v0.4.0 (2024-03-27)
Release Notes
Breaking changes
#[savvy]
on a struct's impl
now generates the same name of R object that
holds all the accociated functions. For example, previously the below code
generates a constructor Person()
, but now the constructor is available as
Person$new()
.
struct Person {
pub name: String,
}
/// @export
#[savvy]
impl Person {
fn new() -> Self {
Self {
name: "".to_string(),
}
}
}
New Features
- A struct marked with
#[savvy]
can be used as the return type of the
associated function. In conjunction with the change in v0.3.0, now a
user-defined struct can be used more flexibly than before. Please refer to
the "Struct" section of the guide
- An experimental support on complex is added under
compex
feature flag.
ComplexSexp
and OwnedComplexSexp
are the corresponding Rust types.
OwnedIntegerSexp
and etc now have set_na(i)
method for shorthand of
set_elt(i, T::na())
. This is particularly useful for OwnedLogicalSexp
because its setter interface set_elt()
only accepts bool
and no missing
values.
Fixed bugs
- An expert-only method
new_without_init()
now skips initialization as
intended.
Download savvy-cli 0.4.0
v0.3.0 (2024-03-24)
Release Notes
New Features
- Now user-defined struct can be used as an argument of
#[savvy]
-ed functions.
It must be specified as &Ty
or &mut Ty
, not Ty
.
Example:
struct Person {
pub name: String,
}
#[savvy]
impl Person {
fn get_name(&self) -> savvy::Result<savvy::Sexp> {
let name = self.name.as_str();
name.try_into()
}
}
#[savvy]
fn get_name_external(x: &Person) -> savvy::Result<savvy::Sexp> {
x.get_name()
}
Fixed bugs
- Previously,
savvy-cli init
and savvy-cli update
didn't handle the package
name properly ("packageName" vs "package_name"). Now it's fixed.
Breaking changes
- While this is described in the New Features section, it was already allowed to
specify user-defined structs as argument if the user defines the necessary
TryFrom
implementations propoerly. At that time, specifying it without &
was possible, but now it's not allowed. Anyway, as this was undocumented and
expert-only usage, I expect no one notices this breaking change.
Download savvy-cli 0.3.0
v0.2.20 (2024-03-23)
Release Notes
New Features
LogicalSexp
and OwnedLogicalSexp
now have as_slice_raw()
method. This
is an expert-only function which might be found useful when you really need
to distinguish NAs.
Minor improvements
savvy-cli init
now generates <dllname>-win.def
to avoid the infamous
"export ordinal too large" error on Windows.
Download savvy-cli 0.2.20
v0.2.18 (2024-03-11)
Release Notes
Minor improvements
- The version requirement is a bit more strict now.
Download savvy-cli 0.2.18
v0.2.17 (2024-03-10)
Release Notes
Breaking changes
get_dim()
now returns &[i32]
instead of Vec<usize>
to avoid allocation.
If the matrix library requires usize
, you need to convert the i32
to
usize
by yourself now.
Accordingly, set_dim()
now accepts both &[i32]
and &[usize]
.
Download savvy-cli 0.2.17
v0.2.16 (2024-03-03)
Release Notes
Breaking changes
fake-libR
feature is withdrawn. Instead, Windows users can add this build
configuration to avoid the linker error:
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-arg=/FORCE:UNRESOLVED"]
Download savvy-cli 0.2.16
v0.2.15 (2024-03-02)
Release Notes
New Features
- Previously, if a crate uses savvy,
cargo test
fails to compile on some
platforms even if the test code doesn't use the savvy API at all. This is
because the symbols from Rinternals.h needs to be resolved. You can add
savvy
with fake-libR
feature in dev-dependencies
to avoid this issue.
[dependencies]
savvy = "*"
[dev-dependencies]
savvy = { version = "*", features = ["fake-libR"] }
Note that, this doesn't mock libR APIs yet.
Fixed bugs
- Reject invalid external pointers so that the R session doesn't crash.
Download savvy-cli 0.2.15
v0.2.14 (2024-02-14)
Release Notes
Fixed bugs
savvy-cli update
and savvy-cli init
now correctly overwrite the existing
files.
Download savvy-cli 0.2.14
v0.2.13 (2024-02-14)
Release Notes
New Features
savvy-cli init
now adds SystemRequirements
to the DESCRIPTION
file.
Fixed bugs
savvy-cli
now works if it's invoked outside of the R package directory.
savvy-cli init
now generates the build configuration with a workaround for
the case of the gnu
toolchain on Windows.
- savvy-cli now requires Rust >= 1.74 because this is clap's MSRV.
Download savvy-cli 0.2.13