Batch anchor resolution, avoid cloning fragment ids when seeking

This commit is contained in:
Max Brunsfeld 2021-12-09 10:42:44 -08:00
parent e9c385e7a6
commit 1ed1ec21dd
3 changed files with 73 additions and 12 deletions

View file

@ -645,9 +645,9 @@ impl Buffer {
assert_eq!(insertion_fragment.fragment_id, fragment.id);
}
let mut cursor = self.snapshot.fragments.cursor::<Locator>();
let mut cursor = self.snapshot.fragments.cursor::<Option<&Locator>>();
for insertion_fragment in self.snapshot.insertions.cursor::<()>() {
cursor.seek(&insertion_fragment.fragment_id, Bias::Left, &None);
cursor.seek(&Some(&insertion_fragment.fragment_id), Bias::Left, &None);
let fragment = cursor.item().unwrap();
assert_eq!(insertion_fragment.fragment_id, fragment.id);
assert_eq!(insertion_fragment.split_offset, fragment.insertion_offset);