v0.6.3 (2024-05-05)
Release Notes
New features
-
New types
NumericSexp
andNumericScalar
are added to handle both integer
and double. You can get a slice viaas_slice_*()
or an iterator via
iter_*()
.#[savvy] fn times_two(x: NumericSexp) -> savvy::Result<Sexp> { let mut out = OwnedIntegerSexp::new(x.len())?; for (i, v) in x.iter_i32().enumerate() { let v = v?; // The item of iter_i32() is Result because the conversion can fail. if v.is_na() { out[i] = i32::na(); } else { out[i] = v * 2; } } out.into() }
You can also use
.into_typed()
to handle integer and double differently.#[savvy] fn times_two(x: NumericSexp) -> savvy::Result<savvy::Sexp> { match x.into_typed() { NumericTypedSexp::Integer(i) => times_two_int(i), NumericTypedSexp::Real(r) => times_two_real(r), } }
-
Savvy now provides
r_stdout()
andr_stderr()
to be used with interfaces
that requirestd::io::Write
. Also, you can usesavvy::log::env_logger()
to
output logs to R's stderr. Here's an example usage:use savvy::savvy_init; use savvy_ffi::DllInfo; #[savvy_init] fn init_logger(dll_info: *mut DllInfo) -> savvy::Result<()> { savvy::log::env_logger().init(); Ok(()) }
Breaking changes
-
AltList
now losesnames
argument ininto_altrep()
for consistency.
Please useset_names()
on the resultedSexp
object.let mut out = v.into_altrep()?; out.set_names(["one", "two"])?; Ok(out)
Download savvy-cli 0.6.3
File | Platform | Checksum |
---|---|---|
savvy-cli-aarch64-apple-darwin.tar.xz | Apple Silicon macOS | checksum |
savvy-cli-x86_64-apple-darwin.tar.xz | Intel macOS | checksum |
savvy-cli-x86_64-pc-windows-msvc.zip | x64 Windows | checksum |
savvy-cli-aarch64-unknown-linux-gnu.tar.xz | ARM64 Linux | checksum |
savvy-cli-x86_64-unknown-linux-gnu.tar.xz | x64 Linux | checksum |