v0.5.0 (2024-04-05)
Release Notes
Breaking change
-
To support enum properly (the details follow), now savvy requires to put
#[savvy]
macro also onstruct
.#[savvy] // NEW! struct Person { pub name: String, } #[savvy] impl Person {
This might be a bit inconvenient on the one hand, but, on the other hand,
several good things are introduced by this change! See the New Features
section.
New features
-
Now
#[savvy]
macro supports enum to express the possible options for a
parameter. This is useful when you want to let users specify some option
without fear of typo. See the guide for more details.Example:
/// @export #[savvy] enum LineType { Solid, Dashed, Dotted, } /// @export #[savvy] fn plot_line(x: IntegerSexp, y: IntegerSexp, line_type: &LineType) -> savvy::Result<()> { match line_type { LineType::Solid => { ... }, LineType::Dashed => { ... }, LineType::Dotted => { ... }, } }
plot_line(x, y, LineType$Solid)
-
Savvy now allows
impl
definition over multiple files. It had been a headache
that it wouldn't compile when you specified#[savvy]
onimpl
of a same
struct multiple times. But now, you can split theimpl
not only within a
same file but also over multiple files.Note that, in general, if you specify a
#[savvy]
function or struct in other
file thanlib.rs
, you need to export the objects by*
. This is because
#[savvy]
defines additional functions other than the original ones and these
also need to be exported. Since you don't know the names of such
auto-generated functions,*
is the solution.mod foo; pub use foo::*;
-
OwnedListSexp
andListSexp
gainsunchecked_*()
variants of theset
and
get
methods for a fast but unsafe operation. Thanks @daniellga!
Download savvy-cli 0.5.0
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 |