Implement anchors using an offset + a version vector
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use super::{Buffer, ToOffset};
|
||||
use crate::time;
|
||||
use crate::{sum_tree, time};
|
||||
use anyhow::Result;
|
||||
use std::{cmp::Ordering, ops::Range};
|
||||
|
||||
@@ -14,12 +14,21 @@ pub enum Anchor {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Hash)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)]
|
||||
pub enum AnchorBias {
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
|
||||
impl AnchorBias {
|
||||
pub fn to_seek_bias(self) -> sum_tree::SeekBias {
|
||||
match self {
|
||||
AnchorBias::Left => sum_tree::SeekBias::Left,
|
||||
AnchorBias::Right => sum_tree::SeekBias::Right,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for AnchorBias {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
|
||||
Reference in New Issue
Block a user