diff --git a/DESCRIPTION b/DESCRIPTION index 454585d..7c5a0ba 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: b64 Title: Fast and Vectorized Base 64 Engine -Version: 0.1.0.9000 +Version: 0.1.1 Authors@R: c( person("Josiah", "Parry", , "josiah.parry@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9910-865X")), diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 6ed1954..f227b5b 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -25,9 +25,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "extendr-api" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d55a0174c4df17c467fb59b3f836bec31d1af6d56c4182cfdf34a62d1553a4" +checksum = "b0701db497d091675e50bb10ba870999742cd1e9a9d94cf3fb52f3ea9a7629c0" dependencies = [ "either", "extendr-macros", @@ -38,9 +38,9 @@ dependencies = [ [[package]] name = "extendr-macros" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33833971650cade4bfa3097b979506bf2b4934b60392e110f95b94c2406cbb84" +checksum = "33d6b806beee182ab3e1105c822df137913b894847a13ec29dfbff9abfb6d1d2" dependencies = [ "proc-macro2", "quote", @@ -49,18 +49,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "libR-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34aaa68a201f71eab5df5a67d1326add8aaf029434e939353bcab0534919ff1" +checksum = "44f2e4b6f402557010b557dd181842168db92da2c0d747bd091bd175941c570d" [[package]] name = "once_cell" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index eb37dfa..e6b3e45 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -5,10 +5,14 @@ version = '0.1.0' edition = '2021' [lib] -crate-type = [ 'staticlib' ] +crate-type = ['staticlib'] name = 'b64' [dependencies] base64 = "0.21.7" -extendr-api = {version = "*", features = ["either"]} +extendr-api = { version = "0.7.0", features = ["either"] } itertools = "0.12.0" + +[profile.release] +lto = true +codegen-units = 1 diff --git a/src/rust/src/lib.rs b/src/rust/src/lib.rs index c95ed35..7484d64 100644 --- a/src/rust/src/lib.rs +++ b/src/rust/src/lib.rs @@ -9,7 +9,7 @@ use extendr_api::prelude::*; use itertools::{Either, Itertools}; use std::io::Read; -#[extendr(use_try_from = true)] +#[extendr] fn encode_(what: Either, engine: Robj) -> String { let eng: ExternalPtr = engine.try_into().unwrap(); match what { @@ -18,7 +18,7 @@ fn encode_(what: Either, engine: Robj) -> String { } } -#[extendr(use_try_from = true)] +#[extendr] fn encode_vectorized_(what: Either, engine: Robj) -> Strings { let eng: ExternalPtr = engine.try_into().unwrap(); match what { @@ -84,7 +84,7 @@ fn encode_file_(path: &str, engine: Robj) -> String { /// @param encoded a character vector of base64 encoded strings. /// @export /// @rdname utils -#[extendr(use_try_from = true)] +#[extendr] fn b64_chunk(encoded: Strings, width: Either) -> List { let width = match width { Left(l) => l, @@ -114,7 +114,7 @@ fn b64_chunk(encoded: Strings, width: Either) -> List { /// @param newline a character scalar defining the newline character. /// @export /// @rdname utils -#[extendr(use_try_from = true)] +#[extendr] fn b64_wrap(chunks: Either, newline: &str) -> Strings { match chunks { Left(l) => l @@ -136,8 +136,8 @@ fn b64_wrap_(chunks: Strings, newline: &str) -> String { chunks.into_iter().join(newline) } -#[extendr(use_try_from = true)] -fn decode_(input: Either, engine: Robj) -> Robj { +#[extendr] +fn decode_(input: Either, engine: Robj) -> List { let eng: ExternalPtr = engine.try_into().unwrap(); let res = match input { Either::Left(s) => { @@ -156,10 +156,11 @@ fn decode_(input: Either, engine: Robj) -> Robj { list!(Raw::from_bytes(&res)) .set_class(&["blob", "vctrs_list_of", "vctrs_vctr", "list"]) .unwrap() + .clone() } -#[extendr(use_try_from = true)] -fn decode_vectorized_(what: Either, engine: Robj) -> Robj { +#[extendr] +fn decode_vectorized_(what: Either, engine: Robj) -> List { let eng: ExternalPtr = engine.try_into().unwrap(); match what { Either::Left(s) => s @@ -181,7 +182,8 @@ fn decode_vectorized_(what: Either, engine: Robj) -> Robj { }) .collect::() .set_class(&["blob", "vctrs_list_of", "vctrs_vctr", "list"]) - .unwrap(), + .unwrap() + .clone(), Either::Right(r) => r .into_iter() .map(|(_, b)| { @@ -199,7 +201,8 @@ fn decode_vectorized_(what: Either, engine: Robj) -> Robj { }) .collect::() .set_class(&["blob", "vctrs_list_of", "vctrs_vctr", "list"]) - .unwrap(), + .unwrap() + .clone(), } } diff --git a/src/rust/vendor.tar.xz b/src/rust/vendor.tar.xz index ac628b4..3c6971a 100644 Binary files a/src/rust/vendor.tar.xz and b/src/rust/vendor.tar.xz differ