From b3b7087041cd766e2257051af19668cd2a3f6f99 Mon Sep 17 00:00:00 2001 From: NexVeridian Date: Fri, 28 Mar 2025 15:44:34 -0700 Subject: [PATCH] refactor: Box --- src/util.rs | 2 +- src/util/df.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util.rs b/src/util.rs index 5aaf43d..43dfa37 100644 --- a/src/util.rs +++ b/src/util.rs @@ -46,7 +46,7 @@ impl Ark { let mut ark = Self { df: match existing_file { true => Self::read_parquet(&ticker, path.as_ref())?, - false => DF::DataFrame(df!["date" => [""],]?), + false => DF::DataFrame(Box::new(df!["date" => [""],]?)), }, ticker, path, diff --git a/src/util/df.rs b/src/util/df.rs index bed277a..265f440 100644 --- a/src/util/df.rs +++ b/src/util/df.rs @@ -4,19 +4,19 @@ use polars::prelude::{IntoLazy, LazyFrame}; #[derive(Clone)] pub enum DF { - LazyFrame(LazyFrame), - DataFrame(DataFrame), + LazyFrame(Box), + DataFrame(Box), } impl From for DF { fn from(lf: LazyFrame) -> Self { - Self::LazyFrame(lf) + Self::LazyFrame(Box::new(lf)) } } impl From for DF { fn from(df: DataFrame) -> Self { - Self::DataFrame(df) + Self::DataFrame(Box::new(df)) } } @@ -24,12 +24,12 @@ impl DF { pub fn collect(self) -> anyhow::Result { match self { Self::LazyFrame(x) => Ok(x.collect()?), - Self::DataFrame(x) => Ok(x), + Self::DataFrame(x) => Ok(*x), } } pub fn lazy(self) -> LazyFrame { match self { - Self::LazyFrame(x) => x, + Self::LazyFrame(x) => *x, Self::DataFrame(x) => x.lazy(), } }