mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cleanup after the fix which is now possible
This commit is contained in:
parent
a4a5cf048e
commit
4726c93f1c
@ -168,10 +168,10 @@ fn main() -> io::Result<()> {
|
||||
let (server_tx, server_rx) = mpsc::channel::<ServerMsg>();
|
||||
|
||||
let mut region_manager = RegionManager::new(region_manager_tx, server_rx);
|
||||
let mut job_manager: Arc<JobManager> = Arc::new(JobManager::new());
|
||||
let job_manager: Arc<JobManager> = Arc::new(JobManager::new());
|
||||
let mut server =
|
||||
worldsim::server::Server::new(server_tx, region_manager_rx, job_manager.clone());
|
||||
let mut region = Region::new((0, 0), job_manager.clone());
|
||||
let _region = Region::new((0, 0), job_manager.clone());
|
||||
|
||||
job_manager.repeat(move || region_manager.work());
|
||||
job_manager.repeat(move || server.work());
|
||||
|
@ -1,12 +1,12 @@
|
||||
use super::index::ToOptionUsize;
|
||||
use super::lodpos::LodPos;
|
||||
use super::layer::{Layer, ParentLayer};
|
||||
#[allow(unused_imports)] //not unsued, cargo is just to stupud to detect that
|
||||
use super::traversable::Traversable;
|
||||
#[allow(unused_imports)]
|
||||
use super::materializeable::Materializeable;
|
||||
#[allow(unused_imports)]
|
||||
use super::entrylayer::EntryLayer;
|
||||
use super::index::ToOptionUsize;
|
||||
use super::layer::{Layer, ParentLayer};
|
||||
use super::lodpos::LodPos;
|
||||
#[allow(unused_imports)]
|
||||
use super::materializeable::Materializeable;
|
||||
#[allow(unused_imports)] //not unsued, cargo is just to stupud to detect that
|
||||
use super::traversable::Traversable;
|
||||
use fxhash::FxHashMap;
|
||||
|
||||
pub trait IndexStore: ParentLayer {
|
||||
@ -48,26 +48,26 @@ pub struct HashNestLayer<C: DetailStore, T, I: ToOptionUsize, const L: u8> {
|
||||
}
|
||||
|
||||
pub struct HashIter<'a, C: DetailStore> {
|
||||
pub( super ) layer: &'a C,
|
||||
pub( super ) wanted: LodPos,
|
||||
pub( super ) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub(super) layer: &'a C,
|
||||
pub(super) wanted: LodPos,
|
||||
pub(super) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
}
|
||||
pub struct HashIterMut<'a, C: DetailStore> {
|
||||
pub( super ) layer: &'a mut C,
|
||||
pub( super ) wanted: LodPos,
|
||||
pub( super ) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub(super) layer: &'a mut C,
|
||||
pub(super) wanted: LodPos,
|
||||
pub(super) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
}
|
||||
pub struct VecIter<'a, C: DetailStore> {
|
||||
pub( super ) layer: &'a C,
|
||||
pub( super ) wanted: LodPos,
|
||||
pub( super ) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub( super ) layer_key: usize,
|
||||
pub(super) layer: &'a C,
|
||||
pub(super) wanted: LodPos,
|
||||
pub(super) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub(super) layer_key: usize,
|
||||
}
|
||||
pub struct VecIterMut<'a, C: DetailStore> {
|
||||
pub( super ) layer: &'a mut C,
|
||||
pub( super ) wanted: LodPos,
|
||||
pub( super ) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub( super ) layer_key: usize,
|
||||
pub(super) layer: &'a mut C,
|
||||
pub(super) wanted: LodPos,
|
||||
pub(super) layer_lod: LodPos, //LodPos aligned to layer::LEVEL
|
||||
pub(super) layer_key: usize,
|
||||
}
|
||||
|
||||
impl<C: DetailStore, T, I: ToOptionUsize, const L: u8> IndexStore for VecNestLayer<C, T, I, { L }> {
|
||||
@ -145,9 +145,9 @@ impl<T, const L: u8> DetailStore for HashLayer<T, { L }> {
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::lodstore::data::*;
|
||||
use test::Bencher;
|
||||
use std::{u16, u32};
|
||||
use crate::lodstore::traversable::Traversable;
|
||||
use std::{u16, u32};
|
||||
use test::Bencher;
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub type ExampleData =
|
||||
@ -257,8 +257,15 @@ pub mod tests {
|
||||
let mut x = gen_simple_example();
|
||||
assert_eq!(*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(), 7_i8);
|
||||
assert_eq!(*x.trav(LodPos::xyz(0, 0, 1)).get().get().get().mat(), 6_i8);
|
||||
x.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get().store(123);
|
||||
assert_eq!(*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(), 123_i8);
|
||||
x.trav_mut(LodPos::xyz(0, 0, 0))
|
||||
.get()
|
||||
.get()
|
||||
.get()
|
||||
.store(123);
|
||||
assert_eq!(
|
||||
*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(),
|
||||
123_i8
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -266,8 +273,15 @@ pub mod tests {
|
||||
let mut x = gen_simple_example();
|
||||
assert_eq!(*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(), 7_i8);
|
||||
let c = *x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat();
|
||||
x.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get().store(111 + c);
|
||||
assert_eq!(*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(), 118_i8);
|
||||
x.trav_mut(LodPos::xyz(0, 0, 0))
|
||||
.get()
|
||||
.get()
|
||||
.get()
|
||||
.store(111 + c);
|
||||
assert_eq!(
|
||||
*x.trav(LodPos::xyz(0, 0, 0)).get().get().get().mat(),
|
||||
118_i8
|
||||
);
|
||||
}
|
||||
|
||||
/* allow this once we guarante get to be consistent even on Hash Lookups!
|
||||
@ -313,28 +327,4 @@ pub mod tests {
|
||||
}
|
||||
b.iter(|| x.trav(access).get().get().get().mat());
|
||||
}
|
||||
|
||||
/*
|
||||
pub struct MyIterMut<'a, C> {
|
||||
pub( super ) layer: &'a mut C,
|
||||
}
|
||||
#[derive(Default, Clone)]
|
||||
pub struct Layer<C> {
|
||||
pub child: C,
|
||||
}
|
||||
pub trait EntryPoint {
|
||||
type TRAV_MUT<'a>;
|
||||
fn trav_mut<'a>(&'a mut self, pos: LodPos) -> Self::TRAV_MUT;
|
||||
}
|
||||
impl<C> EntryPoint
|
||||
for Layer<C>
|
||||
{
|
||||
type TRAV_MUT<'a> = MyIterMut<'a, Layer<C>>;
|
||||
|
||||
fn trav_mut<'a>(&'a mut self, pos: u8) -> Self::TRAV_MUT {
|
||||
MyIterMut {
|
||||
layer: self,
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
use super::data::{DetailStore};
|
||||
use super::lodpos::LodPos;
|
||||
use super::layer::{Layer};
|
||||
use super::data::DetailStore;
|
||||
#[allow(unused_imports)] //not unsued, cargo is just to stupud to detect that
|
||||
use super::entrylayer::EntryLayer;
|
||||
#[allow(unused_imports)]
|
||||
use super::traversable::Traversable;
|
||||
use super::layer::Layer;
|
||||
use super::lodpos::LodPos;
|
||||
#[allow(unused_imports)]
|
||||
use super::materializeable::Materializeable;
|
||||
#[allow(unused_imports)]
|
||||
use super::traversable::Traversable;
|
||||
/*
|
||||
A LodDelta applies a change to a Lod
|
||||
The rules for LodDeltas are strict in order to make them as simple as possible.
|
||||
@ -39,16 +39,16 @@ pub struct DeltaWriter<'a, C: DetailStore, D: DeltaStore> {
|
||||
}
|
||||
|
||||
pub struct VecDeltaIter<'a, D: DeltaStore> {
|
||||
pub( super ) layer: &'a D,
|
||||
pub(super) layer: &'a D,
|
||||
}
|
||||
|
||||
pub struct VecDeltaIterMut<'a, D: DeltaStore> {
|
||||
pub( super ) layer: &'a mut D,
|
||||
pub(super) layer: &'a mut D,
|
||||
}
|
||||
|
||||
pub struct DataWriterIter<DT, CT> {
|
||||
pub( super ) delta_iter: DT,
|
||||
pub( super ) data_iter: CT,
|
||||
pub(super) delta_iter: DT,
|
||||
pub(super) data_iter: CT,
|
||||
}
|
||||
|
||||
//#######################################################
|
||||
@ -124,26 +124,20 @@ mod stests {
|
||||
let mut x = gen_simple_example();
|
||||
let mut d = ExampleDelta::default();
|
||||
//assert_eq!(x.detail_index.len(),1);
|
||||
assert_eq!(d.detail.len(),0);
|
||||
assert_eq!(d.child.detail.len(),0);
|
||||
assert_eq!(d.child.child.detail.len(),0);
|
||||
assert_eq!(d.child.child.child.detail.len(),0);
|
||||
assert_eq!(d.detail.len(), 0);
|
||||
assert_eq!(d.child.detail.len(), 0);
|
||||
assert_eq!(d.child.child.detail.len(), 0);
|
||||
assert_eq!(d.child.child.child.detail.len(), 0);
|
||||
let i = LodPos::xyz(0, 0, 0);
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
assert_eq!(*w.trav_mut(i).get().get().get().mat(), 7_i8);
|
||||
}
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(i).get().get().get().store(123);
|
||||
}
|
||||
{ //TODO: this shouldnt be necessary but somehow it is...
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
assert_eq!(*w.trav_mut(i).get().get().get().mat(), 123_i8);
|
||||
assert_eq!(d.detail.len(),0);
|
||||
assert_eq!(d.child.detail.len(),0);
|
||||
assert_eq!(d.child.child.detail.len(),0);
|
||||
assert_eq!(d.child.child.child.detail.len(),1);
|
||||
assert_eq!(d.detail.len(), 0);
|
||||
assert_eq!(d.child.detail.len(), 0);
|
||||
assert_eq!(d.child.child.detail.len(), 0);
|
||||
assert_eq!(d.child.child.child.detail.len(), 1);
|
||||
//assert_eq!(x.detail_index.len(),1);
|
||||
}
|
||||
}
|
||||
@ -156,28 +150,25 @@ mod stests {
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
assert_eq!(*w.trav_mut(i).get().get().get().mat(), 7_i8);
|
||||
}
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(i).get().get().get().store(123);
|
||||
}
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 1)).get().get().get().store(111);
|
||||
}
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 2)).get().get().get().store(112);
|
||||
}
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 3)).get().get().get().store(111);
|
||||
}
|
||||
{ //TODO: this shouldnt be necessary but somehow it is...
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 1))
|
||||
.get()
|
||||
.get()
|
||||
.get()
|
||||
.store(111);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 2))
|
||||
.get()
|
||||
.get()
|
||||
.get()
|
||||
.store(112);
|
||||
w.trav_mut(LodPos::xyz(0, 0, 3))
|
||||
.get()
|
||||
.get()
|
||||
.get()
|
||||
.store(111);
|
||||
let i = LodPos::xyz(0, 0, 0);
|
||||
assert_eq!(*w.trav_mut(i).get().get().get().mat(), 123_i8);
|
||||
assert_eq!(x.detail_index.len(),1);
|
||||
assert_eq!(x.detail_index.len(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +178,9 @@ mod stests {
|
||||
let mut d = ExampleDelta::default();
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
b.iter(|| {w.trav_mut(LodPos::xyz(0, 0, 0));});
|
||||
b.iter(|| {
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +190,9 @@ mod stests {
|
||||
let mut d = ExampleDelta::default();
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
b.iter(|| {w.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get().mat();});
|
||||
b.iter(|| {
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get().mat();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,14 +202,11 @@ mod stests {
|
||||
let mut d = ExampleDelta::default();
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
//b.iter(|| w.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get());
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0));
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0));
|
||||
b.iter(|| {
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0)).get().get().get();
|
||||
});
|
||||
}
|
||||
}
|
||||
fn ddd<'a,'b:'a, D>() {
|
||||
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_trav(b: &mut Bencher) {
|
||||
@ -222,50 +214,9 @@ mod stests {
|
||||
let mut d = ExampleDelta::default();
|
||||
{
|
||||
let mut w = DeltaWriter::new(&mut d, &mut x);
|
||||
b.iter(|| {w.trav_mut(LodPos::xyz(0, 0, 0));});
|
||||
b.iter(|| {
|
||||
w.trav_mut(LodPos::xyz(0, 0, 0));
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
pub struct ThisWorks<'a> {
|
||||
pub ddd: &'a mut u64,
|
||||
}
|
||||
|
||||
impl<'a> ThisWorks<'a> {
|
||||
fn reff<'b>(&'b mut self) -> &'b mut u64 {
|
||||
self.ddd
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThisDoestn<'a> {
|
||||
pub ddd: &'a mut u64,
|
||||
}
|
||||
|
||||
impl<'a> ThisDoestn<'a> {
|
||||
fn reff<'b>(&'b mut self) -> &'a mut u64 where 'a: 'b {
|
||||
self.ddd
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThisDoestnNeither<'a> {
|
||||
pub ddd: &'a mut u64,
|
||||
}
|
||||
|
||||
impl<'a> ThisDoestnNeither<'a> {
|
||||
fn reff<'b: 'a>(&'b mut self) -> &'a mut u64 {
|
||||
self.ddd
|
||||
}
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_travss(b: &mut Bencher) {
|
||||
let mut u: u64 = 1;
|
||||
let mut d = ThisWorks{ddd: &mut u};
|
||||
{
|
||||
b.iter(|| *d.ddd = *d.ddd + 1_u64);
|
||||
b.iter(|| {d.reff();});
|
||||
d.reff();
|
||||
d.reff();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::lodpos::{LodPos};
|
||||
use super::delta::{DeltaStore, VecDeltaIterMut};
|
||||
use super::lodpos::LodPos;
|
||||
|
||||
pub trait Deltalizeable {
|
||||
type DELTA: DeltaStore;
|
||||
@ -13,4 +13,4 @@ impl<'a, D: DeltaStore> Deltalizeable for VecDeltaIterMut<'a, D> {
|
||||
fn store(self, pos: LodPos, value: Option<D::DETAIL>) {
|
||||
self.layer.store(pos, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
use super::data::{DetailStore, HashIter, HashIterMut, HashNestLayer};
|
||||
use super::delta::{
|
||||
DataWriterIter, DeltaStore, DeltaWriter, VecDeltaIter, VecDeltaIterMut, VecNestDelta,
|
||||
};
|
||||
use super::index::ToOptionUsize;
|
||||
use super::lodpos::LodPos;
|
||||
use super::data::{HashNestLayer, DetailStore, HashIter, HashIterMut};
|
||||
use super::delta::{VecNestDelta, DeltaStore, VecDeltaIter, VecDeltaIterMut, DataWriterIter, DeltaWriter};
|
||||
use super::traversable::Traversable;
|
||||
|
||||
//TODO: actually implement EntryLayer
|
||||
@ -13,8 +15,7 @@ pub trait EntryLayer {
|
||||
}
|
||||
|
||||
///////////////// data types
|
||||
impl<C: DetailStore, T, I: ToOptionUsize, const L: u8> HashNestLayer<C, T, I, { L }>
|
||||
{
|
||||
impl<C: DetailStore, T, I: ToOptionUsize, const L: u8> HashNestLayer<C, T, I, { L }> {
|
||||
pub fn trav<'a>(&'a self, pos: LodPos) -> HashIter<'a, HashNestLayer<C, T, I, { L }>> {
|
||||
HashIter {
|
||||
layer: self,
|
||||
@ -23,7 +24,10 @@ impl<C: DetailStore, T, I: ToOptionUsize, const L: u8> HashNestLayer<C, T, I, {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trav_mut<'a>(&'a mut self, pos: LodPos) -> HashIterMut<'a, HashNestLayer<C, T, I, { L }>> {
|
||||
pub fn trav_mut<'a>(
|
||||
&'a mut self,
|
||||
pos: LodPos,
|
||||
) -> HashIterMut<'a, HashNestLayer<C, T, I, { L }>> {
|
||||
HashIterMut {
|
||||
layer: self,
|
||||
wanted: pos,
|
||||
@ -37,24 +41,40 @@ impl<D: DeltaStore, T, const L: u8> VecNestDelta<D, T, { L }> {
|
||||
pub fn trav<'a>(&'a self, _pos: LodPos) -> VecDeltaIter<'a, VecNestDelta<D, T, { L }>> {
|
||||
VecDeltaIter { layer: self }
|
||||
}
|
||||
pub fn trav_mut<'a>(&'a mut self, _pos: LodPos) -> VecDeltaIterMut<'a, VecNestDelta<D, T, { L }>> {
|
||||
pub fn trav_mut<'a>(
|
||||
&'a mut self,
|
||||
_pos: LodPos,
|
||||
) -> VecDeltaIterMut<'a, VecNestDelta<D, T, { L }>> {
|
||||
VecDeltaIterMut { layer: self }
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: DeltaStore, C: DetailStore, T, I: ToOptionUsize, const L: u8> DeltaWriter<'_, HashNestLayer<C, T, I, { L }>, VecNestDelta<D, T, { L }>>
|
||||
impl<D: DeltaStore, C: DetailStore, T, I: ToOptionUsize, const L: u8>
|
||||
DeltaWriter<'_, HashNestLayer<C, T, I, { L }>, VecNestDelta<D, T, { L }>>
|
||||
{
|
||||
pub fn trav<'a>(&'a self, pos: LodPos) -> DataWriterIter<VecDeltaIter<'a, VecNestDelta<D, T, { L }>>, HashIter<'a, HashNestLayer<C, T, I, { L }>>> {
|
||||
pub fn trav<'a>(
|
||||
&'a self,
|
||||
pos: LodPos,
|
||||
) -> DataWriterIter<
|
||||
VecDeltaIter<'a, VecNestDelta<D, T, { L }>>,
|
||||
HashIter<'a, HashNestLayer<C, T, I, { L }>>,
|
||||
> {
|
||||
DataWriterIter {
|
||||
delta_iter: self.delta.trav(pos),
|
||||
data_iter: self.data.trav(pos),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trav_mut<'a>(&'a mut self, pos: LodPos) -> DataWriterIter< VecDeltaIterMut<'a, VecNestDelta<D, T, { L }>>, HashIterMut<'a, HashNestLayer<C, T, I, { L }>>> {
|
||||
pub fn trav_mut<'a>(
|
||||
&'a mut self,
|
||||
pos: LodPos,
|
||||
) -> DataWriterIter<
|
||||
VecDeltaIterMut<'a, VecNestDelta<D, T, { L }>>,
|
||||
HashIterMut<'a, HashNestLayer<C, T, I, { L }>>,
|
||||
> {
|
||||
DataWriterIter {
|
||||
delta_iter: self.delta.trav_mut(pos),
|
||||
data_iter: self.data.trav_mut(pos),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::data::{DetailStore, HashLayer, HashNestLayer, VecLayer, VecNestLayer};
|
||||
use super::delta::{DeltaStore, VecDelta, VecNestDelta};
|
||||
use super::index::ToOptionUsize;
|
||||
use super::lodpos::{two_pow_u, LodPos};
|
||||
use super::data::{VecLayer, HashLayer, VecNestLayer, HashNestLayer, DetailStore};
|
||||
use super::delta::{VecDelta, VecNestDelta, DeltaStore};
|
||||
use vek::Vec3;
|
||||
|
||||
pub trait Layer {
|
||||
@ -83,4 +83,4 @@ impl<D: DeltaStore, T, const L: u8> ParentLayer for VecNestDelta<D, T, { L }> {
|
||||
fn child_mut(&mut self) -> &mut Self::CHILD {
|
||||
&mut self.child
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::lodpos::{LodPos};
|
||||
use super::data::{DetailStore, HashIter, VecIter, HashIterMut, VecIterMut};
|
||||
use super::delta::{DataWriterIter};
|
||||
use super::deltalizeable::{Deltalizeable};
|
||||
use super::data::{DetailStore, HashIter, HashIterMut, VecIter, VecIterMut};
|
||||
use super::delta::DataWriterIter;
|
||||
use super::deltalizeable::Deltalizeable;
|
||||
use super::lodpos::LodPos;
|
||||
|
||||
/*
|
||||
|
||||
@ -28,15 +28,15 @@ pub trait Materializeable<'a> {
|
||||
///////////////// data types
|
||||
|
||||
impl<'a, L: DetailStore<KEY = LodPos>> Materializeable<'a> for HashIter<'a, L> {
|
||||
type MAT_CHILD = L::DETAIL;
|
||||
type MAT_CHILD = L::DETAIL;
|
||||
|
||||
fn mat(self) -> &'a L::DETAIL {
|
||||
DetailStore::load(self.layer, self.layer_lod)
|
||||
}
|
||||
fn store(self, _mat: L::DETAIL) {
|
||||
unimplemented!("only call on mut Iter");
|
||||
//DetailStore::save(self.layer, self.layer_key, mat)
|
||||
}
|
||||
fn mat(self) -> &'a L::DETAIL {
|
||||
DetailStore::load(self.layer, self.layer_lod)
|
||||
}
|
||||
fn store(self, _mat: L::DETAIL) {
|
||||
unimplemented!("only call on mut Iter");
|
||||
//DetailStore::save(self.layer, self.layer_key, mat)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = LodPos>> Materializeable<'a> for HashIterMut<'a, L> {
|
||||
@ -51,19 +51,23 @@ impl<'a, L: DetailStore<KEY = LodPos>> Materializeable<'a> for HashIterMut<'a, L
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = usize>> Materializeable<'a> for VecIter<'a, L> {
|
||||
type MAT_CHILD = L::DETAIL;
|
||||
type MAT_CHILD = L::DETAIL;
|
||||
|
||||
fn mat(self) -> &'a L::DETAIL { DetailStore::load(self.layer, self.layer_key) }
|
||||
fn store(self, _mat: L::DETAIL) {
|
||||
unimplemented!("only call on mut Iter");
|
||||
//DetailStore::save(self.layer, self.layer_key, mat)
|
||||
}
|
||||
fn mat(self) -> &'a L::DETAIL {
|
||||
DetailStore::load(self.layer, self.layer_key)
|
||||
}
|
||||
fn store(self, _mat: L::DETAIL) {
|
||||
unimplemented!("only call on mut Iter");
|
||||
//DetailStore::save(self.layer, self.layer_key, mat)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = usize>> Materializeable<'a> for VecIterMut<'a, L> {
|
||||
type MAT_CHILD = L::DETAIL;
|
||||
|
||||
fn mat(self) -> &'a L::DETAIL { DetailStore::load(self.layer, self.layer_key) }
|
||||
fn mat(self) -> &'a L::DETAIL {
|
||||
DetailStore::load(self.layer, self.layer_key)
|
||||
}
|
||||
fn store(self, mat: L::DETAIL) {
|
||||
DetailStore::save(self.layer, self.layer_key, mat)
|
||||
}
|
||||
@ -71,19 +75,21 @@ impl<'a, L: DetailStore<KEY = usize>> Materializeable<'a> for VecIterMut<'a, L>
|
||||
|
||||
///////////////// delta types
|
||||
|
||||
impl<'a, DT: Deltalizeable, CT: Materializeable<'a>> Materializeable<'a> for DataWriterIter<DT, CT> {
|
||||
type MAT_CHILD = CT::MAT_CHILD;
|
||||
impl<'a, DT: Deltalizeable, CT: Materializeable<'a>> Materializeable<'a>
|
||||
for DataWriterIter<DT, CT>
|
||||
{
|
||||
type MAT_CHILD = CT::MAT_CHILD;
|
||||
|
||||
fn mat(self) -> &'a CT::MAT_CHILD {
|
||||
self.data_iter.mat()
|
||||
}
|
||||
fn store(self, mat: CT::MAT_CHILD) {
|
||||
//self.delta_iter.register(LodPos::xyz(2,2,2,), mat);
|
||||
fn mat(self) -> &'a CT::MAT_CHILD {
|
||||
self.data_iter.mat()
|
||||
}
|
||||
fn store(self, mat: CT::MAT_CHILD) {
|
||||
//self.delta_iter.register(LodPos::xyz(2,2,2,), mat);
|
||||
|
||||
//<DT as Deltalizeable>::DELTA::store(self.delta_iter,LodPos::xyz(2,2,2), None);
|
||||
self.delta_iter.store(LodPos::xyz(2,2,2), None);
|
||||
println!("saaave");
|
||||
self.data_iter.store(mat);
|
||||
//self.data_iter.store(mat)
|
||||
}
|
||||
//<DT as Deltalizeable>::DELTA::store(self.delta_iter,LodPos::xyz(2,2,2), None);
|
||||
self.delta_iter.store(LodPos::xyz(2, 2, 2), None);
|
||||
println!("saaave");
|
||||
self.data_iter.store(mat);
|
||||
//self.data_iter.store(mat)
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
pub mod lodpos;
|
||||
pub mod lodarea;
|
||||
pub mod layer;
|
||||
pub mod traversable;
|
||||
pub mod materializeable;
|
||||
pub mod deltalizeable;
|
||||
pub mod entrylayer;
|
||||
pub mod data;
|
||||
pub mod delta;
|
||||
pub mod deltalizeable;
|
||||
pub mod drill;
|
||||
pub mod entrylayer;
|
||||
pub mod index;
|
||||
pub mod layer;
|
||||
pub mod lodarea;
|
||||
pub mod lodpos;
|
||||
pub mod materializeable;
|
||||
pub mod traversable;
|
||||
pub use data::{HashLayer, HashNestLayer, VecLayer, VecNestLayer};
|
||||
|
||||
/*
|
||||
|
@ -1,9 +1,9 @@
|
||||
use super::data::{DetailStore, HashIter, HashIterMut, IndexStore, VecIter, VecIterMut};
|
||||
use super::delta::{DataWriterIter, DeltaStore, VecDeltaIter, VecDeltaIterMut};
|
||||
use super::index::ToOptionUsize;
|
||||
use super::lodpos::{multily_with_2_pow_n, relative_to_1d, LodPos};
|
||||
use super::data::{DetailStore, IndexStore, HashIter, VecIter, HashIterMut, VecIterMut};
|
||||
use super::delta::{DeltaStore, VecDeltaIter, VecDeltaIterMut, DataWriterIter};
|
||||
#[allow(unused_imports)] //not unsued, cargo is just to stupud to detect that
|
||||
use super::layer::{Layer, ParentLayer};
|
||||
use super::lodpos::{multily_with_2_pow_n, relative_to_1d, LodPos};
|
||||
|
||||
pub trait Traversable {
|
||||
type TRAV_CHILD;
|
||||
@ -13,8 +13,8 @@ pub trait Traversable {
|
||||
///////////////// data types
|
||||
|
||||
impl<'a, L: DetailStore<KEY = LodPos> + IndexStore> Traversable for HashIter<'a, L>
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
{
|
||||
type TRAV_CHILD = VecIter<'a, L::CHILD>;
|
||||
|
||||
@ -40,8 +40,8 @@ impl<'a, L: DetailStore<KEY = LodPos> + IndexStore> Traversable for HashIter<'a,
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = LodPos> + IndexStore> Traversable for HashIterMut<'a, L>
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
{
|
||||
type TRAV_CHILD = VecIterMut<'a, L::CHILD>;
|
||||
|
||||
@ -67,8 +67,8 @@ impl<'a, L: DetailStore<KEY = LodPos> + IndexStore> Traversable for HashIterMut<
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = usize> + IndexStore> Traversable for VecIter<'a, L>
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
{
|
||||
type TRAV_CHILD = VecIter<'a, L::CHILD>;
|
||||
|
||||
@ -94,8 +94,8 @@ impl<'a, L: DetailStore<KEY = usize> + IndexStore> Traversable for VecIter<'a, L
|
||||
}
|
||||
|
||||
impl<'a, L: DetailStore<KEY = usize> + IndexStore> Traversable for VecIterMut<'a, L>
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
where
|
||||
L::CHILD: DetailStore,
|
||||
{
|
||||
type TRAV_CHILD = VecIterMut<'a, L::CHILD>;
|
||||
|
||||
@ -123,8 +123,8 @@ impl<'a, L: DetailStore<KEY = usize> + IndexStore> Traversable for VecIterMut<'a
|
||||
///////////////// delta types
|
||||
|
||||
impl<'a, D: DeltaStore + ParentLayer> Traversable for VecDeltaIter<'a, D>
|
||||
where
|
||||
D::CHILD: DeltaStore,
|
||||
where
|
||||
D::CHILD: DeltaStore,
|
||||
{
|
||||
type TRAV_CHILD = VecDeltaIter<'a, D::CHILD>;
|
||||
|
||||
@ -136,8 +136,8 @@ impl<'a, D: DeltaStore + ParentLayer> Traversable for VecDeltaIter<'a, D>
|
||||
}
|
||||
|
||||
impl<'a, D: DeltaStore + ParentLayer> Traversable for VecDeltaIterMut<'a, D>
|
||||
where
|
||||
D::CHILD: DeltaStore,
|
||||
where
|
||||
D::CHILD: DeltaStore,
|
||||
{
|
||||
type TRAV_CHILD = VecDeltaIterMut<'a, D::CHILD>;
|
||||
|
||||
@ -157,4 +157,4 @@ impl<DT: Traversable, CT: Traversable> Traversable for DataWriterIter<DT, CT> {
|
||||
data_iter: self.data_iter.get(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user