Skip to content

v0.5.0 (2024-04-05)

Compare
Choose a tag to compare
@github-actions github-actions released this 05 Apr 00:14
· 189 commits to main since this release

Release Notes

Breaking change

  • To support enum properly (the details follow), now savvy requires to put
    #[savvy] macro also on struct.

    #[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] on impl of a same
    struct multiple times. But now, you can split the impl 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 than lib.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 and ListSexp gains unchecked_*() variants of the set 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