Skip to content

Commit

Permalink
bool
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Jul 24, 2023
1 parent fdfc6eb commit 5e79b8b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ta_lib/core/src/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ impl Series<f64> {
self.compare_series(rhs, |a, b| a <= b)
}
}

impl Series<bool> {
pub fn and(&self, rhs: &Series<bool>) -> Series<bool> {
self.zip_with(rhs, |a, b| match (a, b) {
(Some(a_val), Some(b_val)) => Some(*a_val & *b_val),
_ => None,
})
}

pub fn or(&self, rhs: &Series<bool>) -> Series<bool> {
self.zip_with(rhs, |a, b| match (a, b) {
(Some(a_val), Some(b_val)) => Some(*a_val | *b_val),
_ => None,
})
}
}

0 comments on commit 5e79b8b

Please sign in to comment.