use v9::prelude::*; use v9::event::Pushed; use v9::kernel::KernelArg; use std::any::TypeId; #[v9::table] pub struct cheeses { pub flaming: bool, } #[test] fn patch() { let mut universe = Universe::new(); cheeses::Marker::register(&mut universe); type WeightCol = v9::column::Column; universe.add_mut( TypeId::of::(), WeightCol::new(), ); universe.add_tracker_with_ref_arg::<_, _, Pushed>(| ev: KernelArg<&Pushed>, mut weights: v9::column::WriteColumn, // direct access | { unsafe { let weights = weights.col.get_mut(); for id in ev.ids.iter() { weights.data.push(100.1 * (id.0 as f32 + 1.0)); } } }); let id = universe.eval(|mut c: cheeses::Write| { c.push(cheeses::Row { flaming: true }); c.push(cheeses::Row { flaming: false }) }); universe.eval(|weight: v9::column::ReadColumn| { println!("{}", weight[id]); }); }