global: wip

This commit is contained in:
nym21
2025-06-06 12:23:45 +02:00
parent 1921c3d901
commit a11bf5523b
134 changed files with 333 additions and 708 deletions

View File

@@ -1,4 +1,4 @@
use std::iter::Skip;
use std::{iter::Skip, path::Path};
use brk_core::Value;
@@ -20,6 +20,8 @@ pub trait BaseVecIterator: Iterator {
fn len(&self) -> usize;
fn path(&self) -> &Path;
fn is_empty(&self) -> bool {
self.len() == 0
}
@@ -58,7 +60,12 @@ pub trait VecIterator<'a>: BaseVecIterator<Item = (Self::I, Value<'a, Self::T>)>
#[inline]
fn unwrap_get_inner_(&mut self, i: usize) -> Self::T {
self.get_(i).unwrap().into_inner()
self.get_(i)
.unwrap_or_else(|| {
dbg!(self.path(), i, self.len());
panic!("unwrap_get_inner_")
})
.into_inner()
}
#[inline]

View File

@@ -406,6 +406,11 @@ where
fn len(&self) -> usize {
self.vec.len()
}
#[inline]
fn path(&self) -> &Path {
self.vec.path()
}
}
impl<'a, I, T> Iterator for CompressedVecIterator<'a, I, T>

View File

@@ -317,6 +317,16 @@ where
Self::LazyFrom3(i) => i.len(),
}
}
#[inline]
fn path(&self) -> &Path {
match self {
Self::Eager(i) => i.path(),
Self::LazyFrom1(i) => i.path(),
Self::LazyFrom2(i) => i.path(),
Self::LazyFrom3(i) => i.path(),
}
}
}
impl<'a, I, T, S1I, S1T, S2I, S2T, S3I, S3T> IntoIterator

View File

@@ -1,4 +1,4 @@
use std::marker::PhantomData;
use std::{marker::PhantomData, path::Path};
use brk_core::{Result, Value, Version};
@@ -94,6 +94,11 @@ where
fn len(&self) -> usize {
self.source.len()
}
#[inline]
fn path(&self) -> &Path {
self.source.path()
}
}
impl<'a, I, T, S1I, S1T> IntoIterator for &'a LazyVecFrom1<I, T, S1I, S1T>

View File

@@ -1,4 +1,4 @@
use std::marker::PhantomData;
use std::{marker::PhantomData, path::Path};
use brk_core::{Result, Value, Version};
@@ -124,6 +124,11 @@ where
};
len1.min(len2)
}
#[inline]
fn path(&self) -> &Path {
self.source1.path()
}
}
impl<'a, I, T, S1I, S1T, S2I, S2T> IntoIterator for &'a LazyVecFrom2<I, T, S1I, S1T, S2I, S2T>

View File

@@ -1,4 +1,4 @@
use std::marker::PhantomData;
use std::{marker::PhantomData, path::Path};
use brk_core::{Result, Value, Version};
@@ -147,6 +147,11 @@ where
};
len1.min(len2).min(len3)
}
#[inline]
fn path(&self) -> &Path {
self.source1.path()
}
}
impl<'a, I, T, S1I, S1T, S2I, S2T, S3I, S3T> IntoIterator

View File

@@ -230,6 +230,11 @@ where
fn len(&self) -> usize {
self.vec.len()
}
#[inline]
fn path(&self) -> &Path {
self.vec.path()
}
}
impl<'a, I, T> Iterator for RawVecIterator<'a, I, T>

View File

@@ -190,6 +190,14 @@ where
Self::Raw(i) => i.len(),
}
}
#[inline]
fn path(&self) -> &Path {
match self {
Self::Compressed(i) => i.path(),
Self::Raw(i) => i.path(),
}
}
}
impl<'a, I, T> IntoIterator for &'a StoredVec<I, T>