-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependencies #2
Conversation
Currently running into a bug that I'm going to think through how we can address it. First, the check for the raw class isn't working and two, we're returning an library(b64)
x <- encode(c("hello", "world", NA))
y <- lapply(x, charToRaw)
decode(y)
#> <blob[3]>
#> [[1]]
#> <CHARSXP: NA>
#>
#> [[2]]
#> <CHARSXP: NA>
#>
#> [[3]]
#> <CHARSXP: NA> |
We can replace the body of the closure with a let raw = Raw::try_from(b);
match raw {
Ok(r) => {
let decoded = eng.decode(r.as_slice());
match decoded {
Ok(d) => Raw::from_bytes(&d).into_robj(),
Err(_) => ().into_robj(),
}
},
Err(_) => ().into_robj(),
} library(b64)
x <- encode(c("hello", "world", NA))
y <- lapply(x, charToRaw)
decode(y)
#> <blob[3]>
#> [[1]]
#> [1] 68 65 6c 6c 6f
#>
#> [[2]]
#> [1] 77 6f 72 6c 64
#>
#> [[3]]
#> NULL |
Once we fix the vectorized decoding of raws I think this can get merged! Thank you! |
Thanks for your help @JosiahParry, is this what you had in mind? library(b64)
x <- encode(c("hello", "world", NA))
x
#> [1] "aGVsbG8=" "d29ybGQ=" NA
y <- lapply(x, charToRaw)
decode(y)
#> <blob[3]>
#> [[1]]
#> [1] 68 65 6c 6c 6f
#>
#> [[2]]
#> [1] 77 6f 72 6c 64
#>
#> [[3]]
#> NULL
# for pretty printing
library(blob)
decode(y)
#> <blob[3]>
#> [1] blob[5 B] blob[5 B] <NA> |
Close #1. Ready for review @JosiahParry ;)