Skip to content

Commit

Permalink
StripDataSource.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Aug 27, 2024
1 parent 912d1b9 commit 38506fc
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ pub mod http;
pub mod merge_data;
#[cfg(not(target_arch = "wasm32"))]
pub mod parallel_data;
pub mod strip_data;
pub mod timestamp;
57 changes: 57 additions & 0 deletions src/strip_data.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
use crate::data::{
DataSourceDescription, DataSourceInfo, EntryID, EntryIndex, EntryInfo, Field, ItemLink,

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check failure on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check failure on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`

Check warning on line 2 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused imports: `EntryIndex`, `EntryInfo`, `ItemUID`
ItemUID, SlotMetaTile, SlotTile, SummaryTile, TileID, DataSource,
};

pub struct StripDataSource<T: DataSource> {
data_source: T,
}


impl<T: DataSource> StripDataSource<T> {
pub fn new(data_source: T) -> Self {
Self {
data_source,
}
}
}

impl<T: DataSource> DataSource for StripDataSource<T> {
fn fetch_description(&self) -> DataSourceDescription {
self.data_source.fetch_description()
}

fn fetch_info(&self) -> DataSourceInfo {
self.data_source.fetch_info()
}

fn fetch_summary_tile(&self, entry_id: &EntryID, tile_id: TileID, full: bool) -> SummaryTile {
self.data_source.fetch_summary_tile(entry_id, tile_id, full)
}

fn fetch_slot_tile(&self, entry_id: &EntryID, tile_id: TileID, full: bool) -> SlotTile {
self.data_source.fetch_slot_tile(entry_id, tile_id, full)
}

fn fetch_slot_meta_tile(&self, entry_id: &EntryID, tile_id: TileID, full: bool) -> SlotMetaTile {
let mut tile = self.data_source
.fetch_slot_meta_tile(entry_id, tile_id, full);
for row in &mut tile.data.items {
for item in row {
item.title = "Redacted".to_string();
for field in item.fields {
match field.1 {
Field::I64(_) => {},
Field::U64(_) => {},
Field::String(x) => { *x = "Redacted".to_string(); },

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

the size for values of type `str` cannot be known at compilation time

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

mismatched types

Check failure on line 46 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

the size for values of type `str` cannot be known at compilation time
Field::Interval(_) => {},
Field::ItemLink(ItemLink { title, .. }) => { *title = "Redacted".to_string(); },

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Check

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Clippy

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

the size for values of type `str` cannot be known at compilation time

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

mismatched types

Check failure on line 48 in src/strip_data.rs

View workflow job for this annotation

GitHub Actions / Test Suite

the size for values of type `str` cannot be known at compilation time
Field::Vec(_) => { todo!() },
Field::Empty => {},
}
}
}
}
tile
}
}

0 comments on commit 38506fc

Please sign in to comment.