Skip to content

Commit

Permalink
update to a patch-version of extendr
Browse files Browse the repository at this point in the history
  • Loading branch information
CGMossa committed Jul 7, 2024
1 parent 8b10024 commit be552d9
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ opt-level = 3 # was 1 to support 1.66, but since 1.70 is needed anyway it does n
opt-level = 3

[dependencies]
extendr-api = { version = "0.7.0", default-features = false, features = [
extendr-api = { git = "https://github.com/extendr/extendr", rev = "0d0a525b59a1c07c16e0be3e16cabc513f471ced", default-features = false, features = [
"result_list",
"serde",
] }
Expand Down
3 changes: 2 additions & 1 deletion src/rust/src/conversion_r_to_s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ fn recursive_robjname2series_tree(x: &Robj, name: &str) -> pl::PolarsResult<Seri

Rtype::Raw => {
let rpolars_raw_list = list!(x)
.set_class(["rpolars_raw_list", "list"]).cloned()
.set_class(["rpolars_raw_list", "list"])
.cloned()
.map_err(|err| pl::polars_err!(ComputeError: err.to_string()))?;
recursive_robjname2series_tree(&rpolars_raw_list.into_robj(), name)
}
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/conversion_s_to_r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub fn pl_series_to_list(
})
.map(|mut robj| {
robj.set_attrib("tzone", opt_tz.as_ref().map(|s| s.as_str()).unwrap_or(""))
.cloned()
.cloned()
})
.expect("internal error: attr tzone failed")
.map_err(|err| {
Expand Down
1 change: 0 additions & 1 deletion src/rust/src/lazy/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ impl From<pl::LazyFrame> for RPolarsLazyFrame {
}
}

use extendr_api::Result;
#[extendr]
impl RPolarsLazyFrame {
fn print(&self) -> RResult<Self> {
Expand Down
1 change: 0 additions & 1 deletion src/rust/src/lazy/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ impl From<pl::Expr> for RPolarsExpr {
}
}

use extendr_api::Result;
#[extendr]
impl RPolarsExpr {
//constructors
Expand Down
7 changes: 2 additions & 5 deletions src/rust/src/rbackground.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::rpolarserr::{
extendr_to_rpolars_err, polars_to_rpolars_err, rdbg, RPolarsErr, RResult, Rctx, WithRctx,
};
use extendr_api::{
call, eval_string, extendr, extendr_module, list, pairlist, symbol::class_symbol, Attributes,
Conversions, Length, List, Operators, Pairlist, Rinternals, Robj, NULL, R,
call, extendr, extendr_module, list, pairlist, symbol::class_symbol, Attributes, Conversions,
Length, List, Operators, Rinternals, Robj, NULL, R,
};
use flume::{bounded, Sender};
use ipc_channel::ipc;
Expand Down Expand Up @@ -58,9 +58,6 @@ impl<T: Send + Sync + 'static> RPolarsRThreadHandle<T> {
}
}

use extendr_api::Error;
use extendr_api::ExternalPtr;
use extendr_api::Result;
#[extendr]
impl RPolarsRThreadHandle<RResult<RPolarsDataFrame>> {
fn join(&mut self) -> RResult<RPolarsDataFrame> {
Expand Down
12 changes: 9 additions & 3 deletions src/rust/src/rdataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ impl From<pl::DataFrame> for RPolarsDataFrame {
}
}

use extendr_api::Result;
#[extendr]
impl RPolarsDataFrame {
pub fn shape(&self) -> Robj {
Expand Down Expand Up @@ -143,7 +142,11 @@ impl RPolarsDataFrame {
}

//internal use
pub fn set_column_from_robj(&mut self, robj: Robj, name: &str) -> std::result::Result<(), String> {
pub fn set_column_from_robj(
&mut self,
robj: Robj,
name: &str,
) -> std::result::Result<(), String> {
robjname2series(robj, name)
.and_then(|s| self.0.with_column(s).map(|_| ()))
.map_err(|err| format!("in set_column_from_robj: {:?}", err))
Expand Down Expand Up @@ -607,7 +610,10 @@ impl RPolarsDataFrame {
}

impl RPolarsDataFrame {
pub fn to_list_result(&self, int64_conversion: &str) -> std::result::Result<Robj, pl::PolarsError> {
pub fn to_list_result(
&self,
int64_conversion: &str,
) -> std::result::Result<Robj, pl::PolarsError> {
//convert DataFrame to Result of to R vectors, error if DataType is not supported
let robj_vec_res: std::result::Result<Vec<Robj>, _> = self
.0
Expand Down
7 changes: 2 additions & 5 deletions src/rust/src/rpolarserr.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::collections::VecDeque;

use extendr_api::{
call, eval_string, eval_string_with_params, extendr, extendr_module, symbol::class_symbol,
Attributes, Nullable, Operators, Pairlist, Robj, Types, R,
call, extendr, extendr_module, symbol::class_symbol, Attributes, Nullable, Operators, Pairlist,
Robj, Types, R,
};

#[derive(Clone, Debug, thiserror::Error, serde::Deserialize, serde::Serialize)]
Expand Down Expand Up @@ -118,9 +118,6 @@ impl Default for RPolarsErr {
}
}

use extendr_api::Result;
use extendr_api::Error;
use extendr_api::ExternalPtr;
#[extendr]
impl RPolarsErr {
fn default() -> Self {
Expand Down
1 change: 0 additions & 1 deletion src/rust/src/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl From<&RPolarsExpr> for pl::PolarsResult<RPolarsSeries> {
}
}

use extendr_api::Result;
#[extendr]
impl RPolarsSeries {
//utility methods
Expand Down
1 change: 0 additions & 1 deletion src/rust/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::rpolarserr::{polars_to_rpolars_err, rdbg, rerr, RPolarsErr, RResult,
use crate::series::RPolarsSeries;

use crate::rdataframe::{RPolarsDataFrame, RPolarsLazyFrame};
use extendr_api::eval_string_with_params;
use extendr_api::prelude::{list, Result as EResult, Strings};
use extendr_api::Attributes;
use extendr_api::CanBeNA;
Expand Down

0 comments on commit be552d9

Please sign in to comment.