WIP: Avoid converting RopeFingerprint into a string

Co-Authored-By: Petros Amoiridis <petros@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-01-18 12:22:08 +01:00
parent 2c3c8b4cb0
commit a653e87658
6 changed files with 39 additions and 24 deletions

View file

@ -7,7 +7,7 @@ edition = "2021"
path = "src/rope.rs"
[dependencies]
bromberg_sl2 = "0.6"
bromberg_sl2 = { git = "https://github.com/zed-industries/bromberg_sl2", rev = "dac565a90e8f9245f48ff46225c915dc50f76920" }
smallvec = { version = "1.6", features = ["union"] }
sum_tree = { path = "../sum_tree" }
arrayvec = "0.7.1"

View file

@ -4,7 +4,7 @@ mod point_utf16;
mod unclipped;
use arrayvec::ArrayString;
use bromberg_sl2::{DigestString, HashMatrix};
use bromberg_sl2::HashMatrix;
use smallvec::SmallVec;
use std::{
cmp, fmt, io, mem,
@ -25,6 +25,8 @@ const CHUNK_BASE: usize = 6;
#[cfg(not(test))]
const CHUNK_BASE: usize = 16;
pub type RopeFingerprint = HashMatrix;
#[derive(Clone, Default, Debug)]
pub struct Rope {
chunks: SumTree<Chunk>,
@ -361,8 +363,8 @@ impl Rope {
.column
}
pub fn fingerprint(&self) -> String {
self.chunks.summary().fingerprint.to_hex()
pub fn fingerprint(&self) -> RopeFingerprint {
self.chunks.summary().fingerprint
}
}