global: replace Value enum with Cow

This commit is contained in:
nym21
2025-06-27 20:39:19 +02:00
parent 8ea13544de
commit 663092b501
25 changed files with 239 additions and 220 deletions

View File

@@ -1,7 +1,7 @@
use std::{cmp::Ordering, fmt::Debug, path::Path};
use std::{borrow::Cow, cmp::Ordering, fmt::Debug, path::Path};
use arc_swap::ArcSwap;
use brk_core::{Error, Height, Result, Value, Version};
use brk_core::{Error, Height, Result, Version};
use crate::{
AnyCollectableVec, AnyIterableVec, AnyVec, BoxedVecIterator, CollectableVec, Format,
@@ -30,7 +30,7 @@ where
}
#[inline]
pub fn get_or_read(&self, index: I, mmap: &Mmap) -> Result<Option<Value<T>>> {
pub fn get_or_read(&self, index: I, mmap: &Mmap) -> Result<Option<Cow<T>>> {
self.0.get_or_read(index, mmap)
}
@@ -138,7 +138,7 @@ where
I: StoredIndex,
T: StoredType,
{
type Item = (I, Value<'a, T>);
type Item = (I, Cow<'a, T>);
type IntoIter = StoredVecIterator<'a, I, T>;
fn into_iter(self) -> Self::IntoIter {