- Type aliases
RMatrix4DandRMatrix5Dhave been added extendr#875 ExternalPtr<T>and&ExternalPtr<T>can now be used as function arguments with appropriate type checking extendr#853TryFrom<Robj>is now implemented for&ExternalPtr<T>and&mut ExternalPtr<T>extendr#833Option<T>can now be returned from#[extendr]annotated functions for extendr_api types.Noneis translated intoNULLvalue in R [#802]- Conversion of a
Robjthat contains alist()/Listto a compatible tuple(T0, ..., Tn), wherenis atmost 12 [#857] - Added conversions of
[T;N]whereTisRint,Rfloat,Rbool,Rcplx,u8,i32, andf64. [#856] FromIterator<T>andFromIterator<&T>for vector wrapper whereTrepresents a matching underlying type (bool,i32,f64,c64) [#879]
- Breaking change: Adding
#[extendr]above impl blocks no longer provides a default implementation forimpl From<T> for Robjandimpl TryFrom<Robj> for T. Instead, users may annotate their custom structs and enums with#[extendr]to get these default implementations. Note that a user can still derive their own implementations for these traits, and in this case should forego annotating their type with#[extendr]. With this change, users may use#[extendr]on multipleimpl <T>blocks so long as they are contained within their own modules. extendr#882 - Enhancement: string comparisons are now implemented for
Rstrusing R's string intern mechanism. Making string comparisons much faster. [#845] - Breaking change:
RMatrix::get_rownamesandRMatrix::get_colnamesnow both returnOption<Strings>instead of opaqueRobj. [#801]
- Removed
from_sexp_ref()from the public API.from_sexp_ref()is an unsafe method and is for internal use only. [#855]](extendr#855)
- Arguments can be (mutable) typed slices such as
&[Rbool],&mut [Rint]etc. [#790] - New optional
faerfeature which enables conversion betweenfaermatrix andRMatrix<f64>[#706] - Adds
TryFrom<Robj>and<TryFrom<&Robj>forimplblocks marked with#[extendr]macro allowing falliable conversion to&Self&mut Self[#730] - Adds
From<T> for Robjfor impl blocks marked with#[extendr]macro - The new
ExpectedExternalNonNullPtrerror variant provides a more informative error when a null pointer is accessed RArray::data_mutprovides a mutable slice to the underlying array data [#657]- Implements the
Attributestrait for all R vector wrapper structs (e.g.Integers,Doubles,Strings, etc.), allowing for easy access and setting of the attributes of an R object [#745]. This comes with breaking changes. See below. - feature
non-apithat gives access to non-API items; Requires compile-time generation of bindings [#754] TryFrom<&Robj>forStrIter,HashMap<K, Robj>forK = StringandK = &str[#759]
- [Potentially breaking]:
RArray::from_partsno longer requires a pointer to the underlying data vector [#657] #[extendr(use_try_from = true)is now the default setting, therefore the optionuse_try_fromhas been removed [#759]
- R-devel Non-API changes:
- R's C API is being formalized. While the changes are formalized, non-API functions are hidden behind a feature flag to prevent removal from CRAN.
- Non-API changes are in flux in R-devel, however, CRAN has set a July 9th date to remove any package that uses non-API functions. This includes almost every extendr based package on CRAN.
- See [Rd] clarifying and adjusting the C API for R
- nonAPI.txt functions are hidden behind the
non-apifeature flag. - Removed from default include (but may not be limited to):
global_var(),local_var(),base_env(), variousEnvironment,Function,Primitive, andPromisemethods.
Attributestrait now returns a mutable reference toSelf. [#745]. Previously.set_attrib()would modify an object in place, and then return an untyped owned pointer (Robj). Instead, now we return&mut Self.- In
AltReptheunserialize_ex,set_parent,set_envflagsare now hidden behind the feature flagnon-api. Also,Promise::from_partsis marked as non-API. - Floating point numbers with decimal part can no longer be converted to integer types via rounding [#757]
- You can no longer create an
Robjfrom a reference&T, whereTis anextendr-impl. [#759] - You can no longer use
from_robj, as the traitFromRobjas been removed. Instead, usetry_from. - It is no longer possible to access an R integer vector as a
&[u32][#767] - It is no longer possible to generate bindings as part of the compilation of
extendr. Feature
non-apiis broken and will not compile. Related extendr/libR-sys#251
- returning
&Selfor&mut Selffrom a method in an#[extendr]-impl would result in unintended cloning [#614] TryFrom<&Robj>andFromRobjfor integer scalars now correctly handles conversions fromf64[#757]
ALTLISTsupport allowing users to represent structs as R list objects [#600]- [either]
TryFrom<&Robj> for Either<T, R>andFrom<Either<T, R>> for RobjifTandRare themselves implement these traits. This unblocks scenarios like accepting any numeric vector from R viaEither<Integers, Doubles>without extra memory allocation [#480] PartialOrdtrait implementation forRfloat,RintandRbool.RfloatandRintgainedmin()andmax()methods [#573]use_rngoption for theextendrattribute macro, which enables the use of random number sampling methods from R, e.g.#[extendr(use_rng = true)[#476][T; N]conversions toRobj[#594]ToVectorValueforRfloat,RintandRbool[#593]TryFrom<_>onVec<_>forIntegers(i32),Complexes(c64),Doubles(f64), andLogicals(bool/i32). [#593]Rstrcan now be constructed fromOption<String>[#630]
- You can now create
ArrayView1from&Robjas well asRobj[#501] - Raw literals from Rust can be used for function and argument names. e.g.
fn r#type()in Rust is converted totype()in R. [#531] - Fix memory leaks on errors and panics [#555]
- Fixed error when collecting too many objects into
List, etc. [#540]
- Support for setting the default value of arguments to struct methods, using
#[default = "..."][#436] - [ndarray]
TryFrom<&Robj>forArrayView1<T>andArrayView2<T>, whereTisi32,f64,c64,Rint,Rfloat,Rcplx,Rstr,Rbool[#443] Debugtrait implementation forRcplxandComplexes[#444]TryFrom<Robj>,From<Option<T>>,Into<Option<T>>and their variations forNullable<T>[#446]Nullable<T>::map()that acts on not null value and propagatesNULL[#446]- [ndarray] Conversion from owned arrays (ie
ndarray::Array) intoRobj[#450] - [ndarray][docs] Documentation for the
robj_ndarraymodule [#450] Sumfor scalars likeRint,RfloatandRcplx, which acceptIterator<Item = &Rtype>[#454]- A new
collect_rarraymethod that can be used to collect arbitrary iterables into an R matrix [#466] - [docs] Documentation for
RArray::new_matrix()[#466]
- [docs] Use bindgen on docs.rs, to ensure newer R features will still be documented [#426]
- Unify the tagging mechanism used to identify Rust types inside
ExternalPtr. This allows#[extendr]-annotated functions to directly acceptExternalPtr<MyStruct>as well asMyStruct[#433] Nullable<T>is now part ofextendr_api::prelude[#446]- Bump the Rust edition from 2018 to 2021 [#458]
- When converted to
STRSXP, strings are now correctly marked as UTF-8 even on non-UTF-8 platforms (i.e., R < 4.2 on Windows), which shouldn't matter for most of the users [#467]
- The R CMD check note "Found non-API calls to R" by moving
use extendr_engine;insidetest!macro [#424] - The clippy lint "this public function might dereference a raw pointer but is not marked
unsafe" [#451] - A bug where importing a submodule via
use some_module;inside theextendr_module!macro wasn't working [#469]
-
Functiontype that wraps an R function, which can be invoked using thecall()method. [#188] -
pairlist!macro for generatingPairlistobjects, e.g. for use in function calls. [#202] -
use_try_fromoption for theextendrmacro, which allows the use of any type that implementsTryInto<Robj>/TryFrom<Robj>, e.g.#[extendr(use_try_from = true)]. [#222] -
Support for R version 4.2. [#235]
-
call!macro, which can be used to call an R function whose name is provided as a string. [#238] -
Large Rust integer types (
u32,u64andi64) can now be converted to R'snumerictype, which can handle large integer values. [#242] -
TryFrom<Robj>for a large number of Rust types. [#249], [#258] -
S4struct, which wraps an S4 class in R. [#268] -
[ndarray] Implemented
TryFrom<&ArrayBase> for Robj, allowingextendr-annotated functions to return Arrays from thendarraycrate and have them automatically converted to R arrays. [#275] -
Rint,Rdouble,RboolandRcplx:NA-aware wrappers for scalar elements of R vectors [#274], [#284], [#301], [#338], [#350] -
Integers,Doubles,Strings,LogicalsandComplexes: wrappers for R vectors that deref to slices of the above types (RIntetc). [#274], [#284], [#301], [#338], [#350] -
ExternalPtr, a wrapper class for creating R objects containing any Rust object. [#260] -
[graphics] Support for R graphics and graphics devices. The
graphicsfeature flag is disabled by default. [#279], [#360], [#373], [#379], [#380], [#389] -
Derefimplementation for vector types (Rint/Rfloat/Rbool/Rstr/Robj) to appropriately typed Rust slices. [#327] -
defaultoption forextendr-annotated functions, allowing them to have default values, e.g.fn fred(#[default="NULL"] x: Option<i32>) { }. [#334] -
r_nameoption forextendr-annotated functions, allowing the generated R function to have a different name. e.g.#[extendr( use_try_from = true, r_name = "test.rename.rlike", mod_name = "test_rename_mymod" )] fn test_rename() { }
-
Ranytype and theas_anyconversion method. [#320] -
std::fmt::Debugimplementation for wrapper types. [#345] -
#[derive(TryFromRobj)and#[derive(IntoRobj)]which provide an automatic conversion from and to any custom Rust struct andRobj[#347] -
[[operator that works with Rust classes. Its behavior is identical to that of the$operator. [#359] -
LoadandSave, traits that, once implemented, provide the ability to load and save R data in the RDS format. These traits are implemented for allRobj. [#363] -
Dataframewrapper struct. [#393] -
IntoDataFrametrait, which can be derived to allow arbitrary Rust structs to be converted to rows of a data frame. [#393]
-
Strings::eltnow returns anRstr. [#345] -
Renamed
RTypetoRtype. [#345] -
Wrapper types now contain
Robjfields. [#190] -
The
R!macro now accepts strings that contain R code. This is now the recommended way of using the macro, especially with raw strings e.g.R!(r#" print("hello") "#);
-
Improved error handling for
<&str>::try_from(Robj). [#226] -
SymPair::sym_pair()now returns(Option<Robj>, Robj). [#225] -
More detailed error messages when converting Rust integer types to R. [#243]
-
Characteris now calledRstr. [#273] -
[ndarray] Bumped
ndarrayto 0.15.3. Under RFC 1977 this is a "public dependency" change, and therefore can be considered a breaking change, as consumers ofextendrthat use an older version ofndarraywill no longer be compatible until they also bumpndarrayto a compatible version. [#275] -
IsNAtrait has been renamed toCanBeNA. [#288] -
list!has been rewritten, and now returns aListstruct. [#303]
- Calling the
R!macro with non-string types (e.g.R!(1)) is now deprecated. [#203]
Real,Int,Booland the redundant traitSliceIter, which should be replaced withRdouble,Rint, andRboolrespectively. [#304], [#338]TryFromconversions betweenRobjandHashMapfor consistency.List::into_hashmap()andList::from_hashmap()should be used instead. [#254]
-
Added contributing guidelines and code of conduct.
-
Made use of ndarray optional.
-
Made #[extendr] calls panic and thread safe.
-
Added NA handling to the #[extendr] macro.
-
Added a separate extendr-engine crate that is needed when calling R from Rust.
-
Wrapper classes for pairlists, environment, raw, symbols and others.
-
More iterator support.
-
Operators index, slice, dollar, double_colon, +, -, * and /`.
-
Debug printing support expanded to use wrappers.
-
Conversion of Robj to wrapper types.
-
Multithreaded support - allows multithreaded testing using a recursive spinlock.
-
Bool type extended and implemented using TRUE, FALSE and NA_BOOLEAN.
-
Optional parameters to support NA handing.
-
Errors thrown if input parameters without Option are NA.
-
Harmonising of function names into integer, real, logical, symbol, raw, list, pairlist and env.
-
Refactored robj code into several source files.
-
Many functions updated to use generic types.
-
R! macro for executing R source code.
-
call! macro to call R code.
-
sym! macro to generate symbols.
-
Simplification of vector generation using collect_robj and ToVectorValue.
-
Added array types
[1, 2, 3]asRobj::fromtargets. -
Macros now mostly return errors.
- Fix build on Windows and MacOS.