Changelog
Unreleased
Added
Changed
Fixed
Deprecated
0.7.0
Added
- Arguments can be (mutable) typed slices such as
&[Rbool]
,&mut [Rint]
etc. [#790] - New optional
faer
feature which enables conversion betweenfaer
matrix andRMatrix<f64>
[#706] - Adds
TryFrom<Robj>
and<TryFrom<&Robj>
forimpl
blocks marked with#[extendr]
macro allowing falliable conversion to&Self
&mut Self
[#730] - Adds
From<T> for Robj
for impl blocks marked with#[extendr]
macro - The new
ExpectedExternalNonNullPtr
error variant provides a more informative error when a null pointer is accessed RArray::data_mut
provides a mutable slice to the underlying array data [#657]- Implements the
Attributes
trait 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-api
that gives access to non-API items; Requires compile-time generation of bindings [#754] TryFrom<&Robj>
forStrIter
,HashMap<K, Robj>
forK = String
andK = &str
[#759]
Changed
- [Potentially breaking]:
RArray::from_parts
no longer requires a pointer to the underlying data vector [#657] #[extendr(use_try_from = true)
is now the default setting, therefore the optionuse_try_from
has been removed [#759]
Breaking changes
- 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-api
feature flag. - Removed from default include (but may not be limited to):
global_var()
,local_var()
,base_env()
, variousEnvironment
,Function
,Primitive
, andPromise
methods.
Attributes
trait 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
AltRep
theunserialize_ex
,set_parent
,set_envflags
are now hidden behind the feature flagnon-api
. Also,Promise::from_parts
is 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
Robj
from a reference&T
, whereT
is anextendr
-impl. [#759] - You can no longer use
from_robj
, as the traitFromRobj
as 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-api
is broken and will not compile. Related https://github.com/extendr/libR-sys/issues/251
Fixed
0.6.0
Added
ALTLIST
support allowing users to represent structs as R list objects [#600]- [either]
TryFrom<&Robj> for Either<T, R>
andFrom<Either<T, R>> for Robj
ifT
andR
are themselves implement these traits. This unblocks scenarios like accepting any numeric vector from R viaEither<Integers, Doubles>
without extra memory allocation [#480] PartialOrd
trait implementation forRfloat
,Rint
andRbool
.Rfloat
andRint
gainedmin()
andmax()
methods [#573]use_rng
option for theextendr
attribute macro, which enables the use of random number sampling methods from R, e.g.#[extendr(use_rng = true)
[#476][T; N]
conversions toRobj
[#594]ToVectorValue
forRfloat
,Rint
andRbool
[#593]TryFrom<_>
onVec<_>
forIntegers
(i32
),Complexes
(c64
),Doubles
(f64
), andLogicals
(bool
/i32
). [#593]Rstr
can now be constructed fromOption<String>
[#630]
Fixed
- You can now create
ArrayView1
from&Robj
as 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]
0.4.0
Added
- Support for setting the default value of arguments to struct methods, using
#[default = "..."]
[#436] - [ndarray]
TryFrom<&Robj>
forArrayView1<T>
andArrayView2<T>
, whereT
isi32
,f64
,c64
,Rint
,Rfloat
,Rcplx
,Rstr
,Rbool
[#443] Debug
trait implementation forRcplx
andComplexes
[#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_ndarray
module [#450] Sum
for scalars likeRint
,Rfloat
andRcplx
, which acceptIterator<Item = &Rtype>
[#454]- A new
collect_rarray
method that can be used to collect arbitrary iterables into an R matrix [#466] - [docs] Documentation for
RArray::new_matrix()
[#466]
Changed
- [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]
Fixed
- 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]
0.3.0
Added
Function
type that wraps an R function, which can be invoked using thecall()
method. [#188]pairlist!
macro for generatingPairlist
objects, e.g. for use in function calls. [#202]use_try_from
option for theextendr
macro, 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
,u64
andi64
) can now be converted to R’snumeric
type, which can handle large integer values. [#242]TryFrom<Robj>
for a large number of Rust types. [#249], [#258]S4
struct, which wraps an S4 class in R. [#268][ndarray] Implemented
TryFrom<&ArrayBase> for Robj
, allowingextendr
-annotated functions to return Arrays from thendarray
crate and have them automatically converted to R arrays. [#275]Rint
,Rdouble
,Rbool
andRcplx
:NA
-aware wrappers for scalar elements of R vectors [#274], [#284], [#301], [#338], [#350]Integers
,Doubles
,Strings
,Logicals
andComplexes
: wrappers for R vectors that deref to slices of the above types (RInt
etc). [#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
graphics
feature flag is disabled by default. [#279], [#360], [#373], [#379], [#380], [#389]Deref
implementation for vector types (Rint/Rfloat/Rbool/Rstr/Robj) to appropriately typed Rust slices. [#327]default
option forextendr
-annotated functions, allowing them to have default values, e.g.fn fred(#[default="NULL"] x: Option<i32>) { }
. [#334]r_name
option forextendr
-annotated functions, allowing the generated R function to have a different name. e.g.#[extendr( = true, use_try_from = "test.rename.rlike", r_name = "test_rename_mymod" mod_name )] fn test_rename() { }
Rany
type and theas_any
conversion method. [#320]std::fmt::Debug
implementation 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]Load
andSave
, traits that, once implemented, provide the ability to load and save R data in the RDS format. These traits are implemented for allRobj
. [#363]Dataframe
wrapper struct. [#393]IntoDataFrame
trait, which can be derived to allow arbitrary Rust structs to be converted to rows of a data frame. [#393]
Changed
Strings::elt
now returns anRstr
. [#345]Renamed
RType
toRtype
. [#345]Wrapper types now contain
Robj
fields. [#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]
Character
is now calledRstr
. [#273][ndarray] Bumped
ndarray
to 0.15.3. Under RFC 1977 this is a “public dependency” change, and therefore can be considered a breaking change, as consumers ofextendr
that use an older version ofndarray
will no longer be compatible until they also bumpndarray
to a compatible version. [#275]IsNA
trait has been renamed toCanBeNA
. [#288]list!
has been rewritten, and now returns aList
struct. [#303]
Deprecated
- Calling the
R!
macro with non-string types (e.g.R!(1)
) is now deprecated. [#203]
Removed
extendr 0.2.0
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::from
targets.Macros now mostly return errors.
extendr 0.1.10
- Fix build on Windows and MacOS.