1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
use super::{building, tags, Position, PrimInt, TreePath, WithHyperAstPositionConverter};
use std::{fmt::Debug, path::PathBuf};
use num::one;
use crate::{
store::defaults::NodeIdentifier,
types::{
self, AnyType, Children, HyperAST, HyperType, IterableChildren, LabelStore, Labeled,
NodeId, NodeStore, TypeStore, Typed, TypedNodeId, WithChildren, WithSerialization,
},
};
pub use super::offsets_and_nodes::StructuralPosition;
mod path_store;
mod scouting;
pub use scouting::*;
mod typed_scouting;
pub use typed_scouting::*;
#[derive(Clone)]
pub struct ExploreStructuralPositions<'a, IdN, Idx = usize, Config = tags::BottomUpFull> {
sps: &'a StructuralPositionStore<IdN, Idx>,
i: usize,
_phantom: std::marker::PhantomData<Config>,
}
impl<'a, IdN, Idx> super::node_filter_traits::Full for ExploreStructuralPositions<'a, IdN, Idx> {}
impl<'a, IdN, Idx> super::node_filter_traits::NoSpace
for ExploreStructuralPositions<'a, IdN, Idx, tags::BottomUpNoSpace>
{
}
mod esp_impl {
use super::super::position_accessors::*;
use super::*;
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> SolvedPosition<IdN>
for ExploreStructuralPositions<'a, IdN, Idx>
{
fn node(&self) -> IdN {
self.sps.nodes[self.i]
}
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> RootedPosition<IdN>
for ExploreStructuralPositions<'a, IdN, Idx>
{
fn root(&self) -> IdN {
todo!("value must be computed")
}
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> WithOffsets
for ExploreStructuralPositions<'a, IdN, Idx>
{
type Idx = Idx;
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> WithPostOrderOffsets
for ExploreStructuralPositions<'a, IdN, Idx>
{
type It = IterOffsets<'a, IdN, Idx>;
fn iter(&self) -> Self::It {
IterOffsets(self.clone())
}
}
pub struct IterOffsets<'a, IdN, Idx = usize>(ExploreStructuralPositions<'a, IdN, Idx>);
impl<'a, IdN, Idx: PrimInt> Iterator for IterOffsets<'a, IdN, Idx> {
type Item = Idx;
fn next(&mut self) -> Option<Self::Item> {
let o = self.0.sps.offsets[self.0.i];
self.0.try_go_up().map(|_| o - one())
}
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> WithPath<IdN>
for ExploreStructuralPositions<'a, IdN, Idx>
{
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> WithPostOrderPath<IdN>
for ExploreStructuralPositions<'a, IdN, Idx>
{
type ItPath = IterOffsetsNodes<'a, IdN, Idx>;
fn iter_offsets_and_parents(&self) -> Self::ItPath {
IterOffsetsNodes(self.clone())
}
}
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> WithFullPostOrderPath<IdN>
for ExploreStructuralPositions<'a, IdN, Idx>
{
fn iter_with_nodes(&self) -> (IdN, Self::ItPath) {
(self.node(), IterOffsetsNodes(self.clone()))
}
}
pub struct IterOffsetsNodes<'a, IdN, Idx = usize>(ExploreStructuralPositions<'a, IdN, Idx>);
impl<'a, IdN: Copy, Idx: PrimInt> Iterator for IterOffsetsNodes<'a, IdN, Idx> {
type Item = (Idx, IdN);
fn next(&mut self) -> Option<Self::Item> {
let o = self.0.sps.offsets[self.0.i];
self.0.try_go_up().map(|h| (o - one(), self.0.sps.nodes[h.0]))
// let o = self.0.sps.offsets[self.0.i];
// let n = self.0.sps.nodes[self.0.i];
// self.0.try_go_up().map(|h| (o, n))
}
}
}
#[derive(Clone, Copy, Debug)]
pub struct SpHandle(pub(super) usize);
pub struct StructuralPositionStore<IdN = NodeIdentifier, Idx = u16> {
pub nodes: Vec<IdN>,
parents: Vec<usize>,
offsets: Vec<Idx>,
}
// #[derive(Clone, Debug)]
// pub struct StructuralPositionWithIndentation {
// pub(crate) nodes: Vec<NodeIdentifier>,
// pub(crate) offsets: Vec<usize>,
// pub(crate) indentations: Vec<Box<[Space]>>,
// }
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> ExploreStructuralPositions<'a, IdN, Idx> {
pub(super) fn peek_parent_node(&self) -> Option<IdN> {
if self.i == 0 {
return None;
}
let i = self.i - 1;
let r = self.sps.nodes[self.sps.parents[i]];
Some(r)
}
pub(super) fn peek_offset(&self) -> Option<Idx> {
if self.i == 0 {
return None;
}
let i = self.i - 1;
let r = self.sps.offsets[i] - one();
Some(r)
}
pub(super) fn peek_node(&self) -> Option<IdN> {
if self.i == 0 {
return None;
}
let i = self.i - 1;
let r = self.sps.nodes[i];
Some(r)
}
}
impl<'a, IdN: Copy, Idx> Iterator for ExploreStructuralPositions<'a, IdN, Idx> {
type Item = IdN;
fn next(&mut self) -> Option<Self::Item> {
self.try_go_up().map(|i| self.sps.nodes[i.0])
// if self.i == 0 {
// return None;
// } //println!("next: {} {}", self.i, self.sps.parents[self.i - 1]);
// let i = self.i - 1;
// let r = self.sps.nodes[i];
// if i > 0 {
// self.i = self.sps.parents[i] + 1;
// } else {
// self.i = i;
// }
// Some(r)
}
}
impl<'a, IdN, Idx> ExploreStructuralPositions<'a, IdN, Idx> {
/// return previous index
#[inline]
fn try_go_up(&mut self) -> Option<SpHandle> {
if self.i == 0 {
return None;
} //println!("next: {} {}", self.i, self.sps.parents[self.i - 1]);
let i = self.i - 1;
let r = i;
if i > 0 {
self.i = self.sps.parents[i] + 1;
} else {
self.i = i;
}
Some(SpHandle(r))
}
}
// impl<'store, 'src, 'a, IdN: NodeId + Eq + Copy, Idx: PrimInt, HAST>
// WithHyperAstPositionConverter<'store, 'src, ExploreStructuralPositions<'a, IdN, Idx>, HAST>
// {
// // TODO rename to compute_file_and_offset ?
// // pub fn make_file_and_offset(&self) -> Position
// // where
// // 'a: 'store,
// // HAST: HyperAST<'store, IdN = IdN::IdN>,
// // HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// // <<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
// // IdN: Debug + NodeId,
// // IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// // {
// // self.src.clone().make_position(self.stores)
// // }
// // fn make_position2(&self) -> Position
// // where
// // 'a: 'store,
// // HAST: HyperAST<'store, IdN = IdN::IdN>,
// // HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// // <<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
// // IdN: Debug + NodeId,
// // IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// // {
// // let mut from_file = false;
// // let sss: ExploreStructuralPositions<'_, IdN, Idx> = self.src.clone();
// // let len = if let Some(x) = sss.peek_node() {
// // let b = self.stores.node_store().resolve(x.as_id());
// // let t = self.stores.type_store().resolve_type(&b);
// // if let Some(y) = b.try_bytes_len() {
// // if t.is_file() {
// // from_file = true;
// // }
// // y as usize
// // } else {
// // 0
// // }
// // } else {
// // 0
// // };
// // let offset = 0;
// // let path = vec![];
// // Self::make_position2_aux(sss, self.stores, from_file, len, offset, path)
// // }
// // fn make_position2_aux(
// // mut sss: ExploreStructuralPositions<'a, IdN, Idx>,
// // stores: &'store HAST,
// // from_file: bool,
// // len: usize,
// // mut offset: usize,
// // mut path: Vec<&'store str>,
// // ) -> Position
// // where
// // 'a: 'store,
// // HAST: HyperAST<'store, IdN = IdN::IdN>,
// // HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// // IdN: Copy + Debug + NodeId,
// // IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// // {
// // if from_file {
// // while let Some(p) = sss.peek_parent_node() {
// // let b = stores.node_store().resolve(p.as_id());
// // let t = stores.type_store().resolve_type(&b);
// // let o = sss.peek_offset().unwrap();
// // let o: <HAST::T as WithChildren>::ChildIdx =
// // num::cast(o).expect("failed to cast, cannot put value of Idx in ChildIdx");
// // let c: usize = {
// // let v: Vec<_> = b
// // .children()
// // .unwrap()
// // .before(o - one())
// // .iter_children()
// // .collect();
// // v.iter()
// // .map(|x| stores.node_store().resolve(x).try_bytes_len().unwrap())
// // .sum()
// // };
// // offset += c;
// // if t.is_file() {
// // sss.next();
// // break;
// // } else {
// // sss.next();
// // }
// // }
// // }
// // for p in sss {
// // let b = stores.node_store().resolve(p.as_id());
// // let l = stores.label_store().resolve(b.get_label_unchecked());
// // path.push(l)
// // }
// // let file = PathBuf::from_iter(path.iter().rev());
// // Position::new(file, offset, len)
// // }
// }
impl<'store, 'src, 'a, HAST, S> WithHyperAstPositionConverter<'store, 'src, S, HAST>
where
S: super::node_filter_traits::Full,
{
pub fn compute_pos_post_order<O, B, IdN>(&self) -> O
where
HAST: HyperAST<'store, IdN = IdN::IdN>,
S: super::position_accessors::WithFullPostOrderPath<IdN, Idx = HAST::Idx>
+ super::position_accessors::SolvedPosition<IdN>,
IdN: Debug + NodeId + Clone,
IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
<<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
B: building::bottom_up::ReceiveInFile<IdN, HAST::Idx, usize, O>
+ building::bottom_up::CreateBuilder,
B::SB1<O>: building::bottom_up::ReceiveDir<IdN, HAST::Idx, O>,
{
use building::bottom_up;
let builder: B = building::bottom_up::CreateBuilder::create();
let stores = self.stores;
let mut prev_x;
let (mut x, mut iter) = self.src.iter_with_nodes();
let mut o;
let len = {
let b = stores.node_store().resolve(x.as_id());
let t = stores.type_store().resolve_type(&b);
dbg!(t);
let len = b.try_bytes_len();
assert!(len.is_some() || t.is_directory());
prev_x = x;
len
};
use crate::position::building::bottom_up::ReceiveNode;
let mut builder: B::SB1<O> = if let Some(len) = len {
let mut builder = builder.set(len);
let builder = loop {
let Some(aaa) = iter.next() else {
use bottom_up::SetRoot;
return builder.set_root(prev_x)
};
x = aaa.1;
o = aaa.0;
let b = stores.node_store().resolve(x.as_id());
let t = stores.type_store().resolve_type(&b);
dbg!(o);
dbg!(t);
let v = &b.children().unwrap();
dbg!(v
.iter_children()
.map(|x| stores
.type_store()
.resolve_type(&stores.node_store().resolve(x.as_id())))
.collect::<Vec<_>>());
// dbg!(aaa.0);
assert_eq!(Some(prev_x.as_id()), v.get(o));
let v = v.before(o);
let v: Vec<_> = v.iter_children().collect();
let c = v
.into_iter()
.map(|x| {
let b = stores.node_store().resolve(x);
// println!("{:?}", b.get_type());
// println!("T1:{:?}", b.get_type());
b.try_bytes_len().unwrap() as usize
})
.sum();
use bottom_up::{ReceiveIdx, ReceiveOffset};
builder = builder.push(prev_x).push(c).push(o);
prev_x = x;
if t.is_file() {
let l = stores.label_store().resolve(b.get_label_unchecked());
break bottom_up::ReceiveDirName::push(builder, l);
}
};
builder
} else {
builder.transit()
};
loop {
let Some(aaa) = iter.next() else {
use bottom_up::SetRoot;
return builder.set_root(prev_x)
};
x = aaa.1;
o = aaa.0;
let b = stores.node_store().resolve(x.as_id());
let t = stores.type_store().resolve_type(&b);
dbg!(t);
let v = &b.children().unwrap();
dbg!(v
.iter_children()
.map(|x| stores
.type_store()
.resolve_type(&stores.node_store().resolve(x.as_id())))
.collect::<Vec<_>>());
use bottom_up::{ReceiveIdx, ReceiveNode, ReceiveOffset};
builder = builder.push(prev_x).push(o);
prev_x = x;
}
}
}
// impl<'store, 'src, 'a, IdN: NodeId + Eq + Copy, Idx: PrimInt, HAST>
// From<
// WithHyperAstPositionConverter<'store, 'src, ExploreStructuralPositions<'a, IdN, Idx>, HAST>,
// > for Position
// where
// 'a: 'store,
// HAST: HyperAST<'store, IdN = IdN::IdN>,
// HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// <<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
// IdN: Debug + NodeId,
// IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// {
// fn from(
// value: WithHyperAstPositionConverter<
// 'store,
// 'src,
// ExploreStructuralPositions<'a, IdN, Idx>,
// HAST,
// >,
// ) -> Self {
// WithHyperAstPositionConverter::make_file_and_offset(&value)
// }
// }
// TODO separate concerns
// TODO make_position should be a From<ExploreStructuralPositions> for FileAndOffsetPostionT and moved to relevant place
// TODO here the remaining logic should be about giving an iterator through the structural position
impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> ExploreStructuralPositions<'a, IdN, Idx> {
fn make_position<'store, HAST>(self, stores: &'store HAST) -> Position
where
'a: 'store,
HAST: HyperAST<'store, IdN = IdN::IdN>,
HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
<<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
IdN: Debug + NodeId,
IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
{
self.sps.check(stores).unwrap();
// let parents = self.parents.iter().peekable();
let mut from_file = false;
// let mut len = 0;
let len = if let Some(x) = self.peek_node() {
let b = stores.node_store().resolve(x.as_id());
let t = stores.type_store().resolve_type(&b);
if let Some(y) = b.try_bytes_len() {
if t.is_file() {
from_file = true;
}
y as usize
// Some(x)
} else {
0
// None
}
} else {
0
// None
};
let offset = 0;
let path = vec![];
self.make_position_aux(stores, from_file, len, offset, path)
}
fn make_position_aux<'store: 'a, HAST>(
mut self,
stores: &'store HAST,
from_file: bool,
len: usize,
mut offset: usize,
mut path: Vec<&'a str>,
) -> Position
where
HAST: HyperAST<'store, IdN = IdN::IdN>,
HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
IdN: Copy + Debug + NodeId,
IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
{
// println!(
// "it: {:?},{:?},{:?}",
// &it.sps.nodes, &it.sps.offsets, &it.sps.parents
// );
if from_file {
while let Some(p) = self.peek_parent_node() {
// println!("i: {}", it.i);
assert_ne!(p, self.peek_node().unwrap());
assert_eq!(p, self.sps.nodes[self.sps.parents[self.i - 1]]);
assert_eq!(self.peek_node().unwrap(), self.sps.nodes[self.i - 1]);
// println!("nodes: {}, parents:{}, offsets:{}",it.sps.nodes.len(),it.sps.parents.len(),it.sps.offsets.len());
let b = stores.node_store().resolve(p.as_id());
let t = stores.type_store().resolve_type(&b);
// println!("T0:{:?}", t);
// let o = it.sps.offsets[it]
// println!("nodes: ({})", it.sps.nodes.len());
// println!("offsets: ({}) {:?}", it.sps.offsets.len(), &it.sps.offsets);
// println!("parents: ({}) {:?}", it.sps.parents.len(), &it.sps.parents);
// println!(
// "o: {}, o p: {}",
// it.peek_offset().unwrap(),
// it.sps.offsets[it.sps.parents[it.i - 1]]
// );
let o = self.peek_offset().unwrap();
let o: <HAST::T as WithChildren>::ChildIdx =
num::cast(o).expect("failed to cast, cannot put value of Idx in ChildIdx");
if self.peek_node().unwrap().as_id() != &b.children().unwrap()[o] {
if self.peek_node().unwrap().as_id() != &b.children().unwrap()[o] {
log::error!("backtrace: {}", std::backtrace::Backtrace::force_capture());
}
assert_eq!(
self.peek_node().unwrap().as_id(),
&b.children().unwrap()[o],
"p:{:?} b.cs:{:?} o:{:?} o p:{:?} i p:{}",
p,
b.children().unwrap().iter_children().collect::<Vec<_>>(),
self.peek_offset().unwrap(),
self.sps.offsets[self.sps.parents[self.i - 1]] - one(),
self.sps.parents[self.i - 1],
);
}
let c: usize = {
let v: Vec<_> = b
.children()
.unwrap()
.before(o)
.iter_children()
.collect();
v.iter()
.map(|x| {
let b = stores.node_store().resolve(x);
// println!("{:?}", b.get_type());
// println!("T1:{:?}", b.get_type());
b.try_bytes_len().unwrap() as usize
})
.sum()
};
offset += c;
if t.is_file() {
self.next();
break;
} else {
self.next();
}
}
}
for p in self {
let b = stores.node_store().resolve(p.as_id());
// println!("type {:?}", b.get_type());
// if !b.has_label() {
// panic!("{:?} should have a label", b.get_type());
// }
if let Some(l) = b.try_get_label() {
let l = stores.label_store().resolve(l);
// println!("value: {}",l);
// path = path.join(path)
path.push(l)
}
}
let file = PathBuf::from_iter(path.iter().rev());
Position::new(file, offset, len)
}
}
// impl<'a, IdN: NodeId + Eq + Copy, Idx: PrimInt> ExploreStructuralPositions<'a, IdN, Idx> {
// fn make_position2<'store, HAST>(self, stores: &'store HAST) -> Position
// where
// 'a: 'store,
// HAST: HyperAST<'store, IdN = IdN::IdN>,
// HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// <<HAST as HyperAST<'store>>::T as types::WithChildren>::ChildIdx: Debug,
// IdN: Debug + NodeId,
// IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// {
// self.sps.check(stores).unwrap();
// let mut from_file = false;
// let len = if let Some(x) = self.peek_node() {
// let b = stores.node_store().resolve(x.as_id());
// let t = stores.type_store().resolve_type(&b);
// if let Some(y) = b.try_bytes_len() {
// if t.is_file() {
// from_file = true;
// }
// y as usize
// } else {
// 0
// }
// } else {
// 0
// };
// let offset = 0;
// let path = vec![];
// self.make_position2_aux(stores, from_file, len, offset, path)
// }
// fn make_position2_aux<'store: 'a, HAST>(
// mut self,
// stores: &'store HAST,
// from_file: bool,
// len: usize,
// mut offset: usize,
// mut path: Vec<&'a str>,
// ) -> Position
// where
// HAST: HyperAST<'store, IdN = IdN::IdN>,
// HAST::T: Typed<Type = AnyType> + WithSerialization + WithChildren,
// IdN: Copy + Debug + NodeId,
// IdN::IdN: NodeId<IdN = IdN::IdN> + Eq + Debug,
// {
// if from_file {
// while let Some(p) = self.peek_parent_node() {
// let b = stores.node_store().resolve(p.as_id());
// let t = stores.type_store().resolve_type(&b);
// let o = self
// .peek_offset()
// .expect("there should be an offset if there is a parent");
// let o: <HAST::T as WithChildren>::ChildIdx =
// num::cast(o).expect("failed to cast, cannot put value of Idx in ChildIdx");
// let c: usize = {
// let v: Vec<_> = b
// .children()
// .unwrap()
// .before(o)
// .iter_children()
// .collect();
// v.iter()
// .map(|x| stores.node_store().resolve(x).try_bytes_len().unwrap())
// .sum()
// };
// offset += c;
// if t.is_file() {
// self.next();
// break;
// } else {
// self.next();
// }
// }
// }
// for p in self {
// let b = stores.node_store().resolve(p.as_id());
// let l = stores.label_store().resolve(b.get_label_unchecked());
// path.push(l)
// }
// let file = PathBuf::from_iter(path.iter().rev());
// Position::new(file, offset, len)
// }
// }
impl<TIdN: TypedNodeId, Idx> From<TypedScout<TIdN, Idx>> for Scout<TIdN::IdN, Idx> {
fn from(value: TypedScout<TIdN, Idx>) -> Self {
Self {
ancestors: value.ancestors,
path: value.path,
}
}
}