Skip to content

Commit

Permalink
Make this work in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Mar 25, 2024
1 parent 3b0c5d6 commit d7c4ef5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 8 additions & 6 deletions iroh-sync/src/ranger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ pub trait RangeEntry: Debug + Clone {

/// A trait constraining types that are valid entry keys.
pub trait RangeKey: Sized + Debug + Ord + PartialEq + Clone + 'static {
// /// Returns `true` if `self` is a prefix of `other`.
// fn is_prefix_of(&self, other: &Self) -> bool;
/// Returns `true` if `self` is a prefix of `other`.
#[cfg(test)]
fn is_prefix_of(&self, other: &Self) -> bool;

// /// Returns true if `other` is a prefix of `self`.
// fn is_prefixed_by(&self, other: &Self) -> bool {
// other.is_prefix_of(self)
// }
/// Returns true if `other` is a prefix of `self`.
#[cfg(test)]
fn is_prefixed_by(&self, other: &Self) -> bool {
other.is_prefix_of(self)
}
}

/// A trait constraining types that are valid entry values.
Expand Down
7 changes: 4 additions & 3 deletions iroh-sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,9 +974,10 @@ impl Debug for RecordIdentifier {
}

impl RangeKey for RecordIdentifier {
// fn is_prefix_of(&self, other: &Self) -> bool {
// other.as_ref().starts_with(self.as_ref())
// }
#[cfg(test)]
fn is_prefix_of(&self, other: &Self) -> bool {
other.as_ref().starts_with(self.as_ref())
}
}

fn system_time_now() -> u64 {
Expand Down

0 comments on commit d7c4ef5

Please sign in to comment.