diff --git a/src/rust/src/lazy/dataframe.rs b/src/rust/src/lazy/dataframe.rs index 6e72d54f3..8d14f2478 100644 --- a/src/rust/src/lazy/dataframe.rs +++ b/src/rust/src/lazy/dataframe.rs @@ -260,7 +260,7 @@ impl RPolarsLazyFrame { Ok(out.into()) } - fn shift(&self, periods: Robj) -> Result { + fn shift(&self, periods: Robj) -> RResult { Ok(self.clone().0.shift(robj_to!(i64, periods)?).into()) } @@ -276,11 +276,11 @@ impl RPolarsLazyFrame { self.0.clone().reverse().into() } - fn drop(&self, columns: Robj) -> Result { + fn drop(&self, columns: Robj) -> RResult { Ok(self.0.clone().drop(robj_to!(Vec, String, columns)?).into()) } - fn fill_nan(&self, fill_value: Robj) -> Result { + fn fill_nan(&self, fill_value: Robj) -> RResult { Ok(self .0 .clone() @@ -288,7 +288,7 @@ impl RPolarsLazyFrame { .into()) } - fn fill_null(&self, fill_value: Robj) -> Result { + fn fill_null(&self, fill_value: Robj) -> RResult { Ok(self .0 .clone() @@ -296,7 +296,7 @@ impl RPolarsLazyFrame { .into()) } - fn slice(&self, offset: Robj, length: Robj) -> Result { + fn slice(&self, offset: Robj, length: Robj) -> RResult { Ok(RPolarsLazyFrame(self.0.clone().slice( robj_to!(i64, offset)?, robj_to!(Option, u32, length)?.unwrap_or(u32::MAX), @@ -327,7 +327,7 @@ impl RPolarsLazyFrame { Ok(RPolarsLazyFrame(self.clone().0.select_seq(exprs))) } - fn tail(&self, n: Robj) -> Result { + fn tail(&self, n: Robj) -> RResult { Ok(RPolarsLazyFrame(self.0.clone().tail(robj_to!(u32, n)?))) } @@ -346,7 +346,7 @@ impl RPolarsLazyFrame { Ok(out) } - fn unique(&self, subset: Robj, keep: Robj, maintain_order: Robj) -> RResult { + fn unique(&self, subset: Robj, keep: Robj, maintain_order: Robj) -> RResult { let ke = robj_to!(UniqueKeepStrategy, keep)?; let maintain_order = robj_to!(bool, maintain_order)?; let subset = robj_to!(Option, Vec, String, subset)?; @@ -450,7 +450,7 @@ impl RPolarsLazyFrame { suffix: Robj, allow_parallel: Robj, force_parallel: Robj, - ) -> RResult { + ) -> RResult { Ok(RPolarsLazyFrame( self.0 .clone() @@ -512,7 +512,7 @@ impl RPolarsLazyFrame { value_name: Robj, variable_name: Robj, streamable: Robj, - ) -> Result { + ) -> RResult { let args = MeltArgs { id_vars: strings_to_smartstrings(robj_to!(Vec, String, id_vars)?), value_vars: strings_to_smartstrings(robj_to!(Vec, String, value_vars)?), @@ -523,7 +523,7 @@ impl RPolarsLazyFrame { Ok(self.0.clone().melt(args).into()) } - fn rename(&self, existing: Robj, new: Robj) -> Result { + fn rename(&self, existing: Robj, new: Robj) -> RResult { Ok(self .0 .clone() @@ -611,7 +611,7 @@ impl RPolarsLazyFrame { profile_with_r_func_support(self.0.clone()).map(|(r, p)| list!(result = r, profile = p)) } - fn explode(&self, dotdotdot: Robj) -> RResult { + fn explode(&self, dotdotdot: Robj) -> RResult { Ok(self .0 .clone() diff --git a/src/rust/src/lazy/dsl.rs b/src/rust/src/lazy/dsl.rs index 2f67e0d96..6e3b2ab31 100644 --- a/src/rust/src/lazy/dsl.rs +++ b/src/rust/src/lazy/dsl.rs @@ -2184,7 +2184,7 @@ impl RPolarsExpr { .into()) } - pub fn str_split(&self, by: Robj, inclusive: Robj) -> Result { + pub fn str_split(&self, by: Robj, inclusive: Robj) -> RResult { let by = robj_to!(PLExpr, by)?; let inclusive = robj_to!(bool, inclusive)?; if inclusive { @@ -2194,12 +2194,7 @@ impl RPolarsExpr { } } - pub fn str_split_exact( - &self, - by: Robj, - n: Robj, - inclusive: Robj, - ) -> Result { + pub fn str_split_exact(&self, by: Robj, n: Robj, inclusive: Robj) -> RResult { let by = robj_to!(PLExpr, by)?; let n = robj_to!(usize, n)?; let inclusive = robj_to!(bool, inclusive)?; @@ -2211,7 +2206,7 @@ impl RPolarsExpr { .into()) } - pub fn str_splitn(&self, by: Robj, n: Robj) -> Result { + pub fn str_splitn(&self, by: Robj, n: Robj) -> RResult { Ok(self .0 .clone() @@ -2226,7 +2221,7 @@ impl RPolarsExpr { value: Robj, literal: Robj, n: Robj, - ) -> Result { + ) -> RResult { let pat = robj_to!(PLExpr, pat)?; let value = robj_to!(PLExpr, value)?; let literal = robj_to!(bool, literal)?; @@ -2239,26 +2234,21 @@ impl RPolarsExpr { .into()) } - pub fn str_replace_all( - &self, - pat: Robj, - value: Robj, - literal: Robj, - ) -> Result { + pub fn str_replace_all(&self, pat: Robj, value: Robj, literal: Robj) -> RResult { let pat = robj_to!(PLExpr, pat)?; let value = robj_to!(PLExpr, value)?; let literal = robj_to!(bool, literal)?; Ok(self.0.clone().str().replace_all(pat, value, literal).into()) } - pub fn str_slice(&self, offset: Robj, length: Robj) -> Result { + pub fn str_slice(&self, offset: Robj, length: Robj) -> RResult { let offset = robj_to!(PLExprCol, offset)?; let length = robj_to!(PLExprCol, length)?; Ok(self.clone().0.str().slice(offset, length).into()) } - pub fn str_explode(&self) -> Result { + pub fn str_explode(&self) -> RResult { Ok(self.0.clone().str().explode().into()) } @@ -2362,17 +2352,17 @@ impl RPolarsExpr { self.0.clone().binary().base64_encode().into() } - pub fn bin_hex_decode(&self, strict: Robj) -> Result { + pub fn bin_hex_decode(&self, strict: Robj) -> RResult { let strict = robj_to!(bool, strict)?; Ok(self.0.clone().binary().hex_decode(strict).into()) } - pub fn bin_base64_decode(&self, strict: Robj) -> Result { + pub fn bin_base64_decode(&self, strict: Robj) -> RResult { let strict = robj_to!(bool, strict)?; Ok(self.0.clone().binary().base64_decode(strict).into()) } - pub fn struct_field_by_name(&self, name: Robj) -> Result { + pub fn struct_field_by_name(&self, name: Robj) -> RResult { Ok(self .0 .clone() @@ -2385,7 +2375,7 @@ impl RPolarsExpr { // self.0.clone().struct_().field_by_index(index).into() // } - pub fn struct_rename_fields(&self, names: Robj) -> Result { + pub fn struct_rename_fields(&self, names: Robj) -> RResult { let string_vec: Vec = robj_to!(Vec, String, names)?; Ok(self.0.clone().struct_().rename_fields(string_vec).into()) } diff --git a/src/rust/src/rdataframe/mod.rs b/src/rust/src/rdataframe/mod.rs index 9b2884119..90594593f 100644 --- a/src/rust/src/rdataframe/mod.rs +++ b/src/rust/src/rdataframe/mod.rs @@ -306,19 +306,19 @@ impl RPolarsDataFrame { RPolarsSeries(self.0.drop_in_place(names).unwrap()) } - pub fn select(&self, exprs: Robj) -> RResult { + pub fn select(&self, exprs: Robj) -> RResult { self.lazy().select(exprs)?.collect() } - pub fn select_seq(&self, exprs: Robj) -> RResult { + pub fn select_seq(&self, exprs: Robj) -> RResult { self.lazy().select_seq(exprs)?.collect() } - pub fn with_columns(&self, exprs: Robj) -> RResult { + pub fn with_columns(&self, exprs: Robj) -> RResult { self.lazy().with_columns(exprs)?.collect() } - pub fn with_columns_seq(&self, exprs: Robj) -> RResult { + pub fn with_columns_seq(&self, exprs: Robj) -> RResult { self.lazy().with_columns_seq(exprs)?.collect() } diff --git a/src/rust/src/series.rs b/src/rust/src/series.rs index 2efbe8306..089a2b68c 100644 --- a/src/rust/src/series.rs +++ b/src/rust/src/series.rs @@ -91,7 +91,7 @@ impl From<&RPolarsExpr> for pl::PolarsResult { #[extendr] impl RPolarsSeries { //utility methods - pub fn new(name: Robj, values: Robj) -> RResult { + pub fn new(name: Robj, values: Robj) -> RResult { robjname2series(values, robj_to!(str, name)?) .map_err(polars_to_rpolars_err) .map(RPolarsSeries)