automerge/rust/automerge/src/query/len.rs
Alex Good dd3c6d1303
Move rust workspace into ./rust
After some discussion with PVH I realise that the repo structure in the
last reorg was very rust-centric. In an attempt to put each language on
a level footing move the rust code and project files into ./rust
2022-10-16 19:55:51 +01:00

21 lines
445 B
Rust

use crate::op_tree::OpTreeNode;
use crate::query::{QueryResult, TreeQuery};
use std::fmt::Debug;
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct Len {
pub(crate) len: usize,
}
impl Len {
pub(crate) fn new() -> Self {
Len { len: 0 }
}
}
impl<'a> TreeQuery<'a> for Len {
fn query_node(&mut self, child: &OpTreeNode) -> QueryResult {
self.len = child.index.visible_len();
QueryResult::Finish
}
}