Refactor AsAny handling

This commit is contained in:
Dominik Werder
2022-12-12 15:53:53 +01:00
parent 87dde4712e
commit e81337c22f
29 changed files with 524 additions and 269 deletions

View File

@@ -46,7 +46,7 @@ fn time_bin_00() {
Ok(item) => match item {
StreamItem::DataItem(item) => match item {
RangeCompletableItem::Data(item) => {
if let Some(item) = item.as_any().downcast_ref::<BinsDim0<f32>>() {
if let Some(item) = item.as_any_ref().downcast_ref::<BinsDim0<f32>>() {
let exp = exps.pop_front().unwrap();
if !item.equal_slack(&exp) {
return Err(Error::with_msg_no_trace(format!("bad, content not equal")));
@@ -104,7 +104,7 @@ fn time_bin_01() {
Ok(item) => match item {
StreamItem::DataItem(item) => match item {
RangeCompletableItem::Data(item) => {
if let Some(_) = item.as_any().downcast_ref::<BinsDim0<f32>>() {
if let Some(_) = item.as_any_ref().downcast_ref::<BinsDim0<f32>>() {
} else {
return Err(Error::with_msg_no_trace(format!("bad, got item with unexpected type")));
}