tp 0.1.26

text processing utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::TxtPos;

impl<'a> TxtPos<'a> {
  pub fn extend(&mut self, tp: TxtPos<'a>) {
    let offset = self.txt_li.len() as u64;
    if offset == 0 {
      self.pos_li = tp.pos_li;
    } else {
      self
        .pos_li
        .extend(tp.pos_li.into_iter().map(|i| i + offset));
    }
    self.txt_li.extend(tp.txt_li);
  }
}