Skip to content

Commit e35605b

Browse files
committed
rename covers to is_start_of
1 parent 52372da commit e35605b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

foundationdb/src/subspace.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ impl Subspace {
6868
/// removed. `unpack` will return an error if the key is not in this Subspace or does not
6969
/// encode a well-formed Tuple.
7070
pub fn unpack<T: Tuple>(&self, key: &[u8]) -> Result<T, TupleError> {
71-
if !self.covers(key) {
71+
if !self.is_start_of(key) {
7272
return Err(TupleError::InvalidData);
7373
}
7474
let key = &key[self.prefix.len()..];
7575
Tuple::decode(&key)
7676
}
7777

78-
/// `covers` returns true if the provided key starts with the prefix of this Subspace,
78+
/// `is_start_of` returns true if the provided key starts with the prefix of this Subspace,
7979
/// indicating that the Subspace logically contains the key.
80-
pub fn covers(&self, key: &[u8]) -> bool {
80+
pub fn is_start_of(&self, key: &[u8]) -> bool {
8181
key.starts_with(&self.prefix)
8282
}
8383

@@ -124,13 +124,13 @@ mod tests {
124124
}
125125

126126
#[test]
127-
fn covers() {
127+
fn is_start_of() {
128128
let ss0 = Subspace::new(&(1,));
129129
let ss1 = Subspace::new(&(2,));
130130
let tup = (2, 3);
131131

132-
assert!(ss0.covers(&ss0.pack(&tup)));
133-
assert!(!ss1.covers(&ss0.pack(&tup)));
132+
assert!(ss0.is_start_of(&ss0.pack(&tup)));
133+
assert!(!ss1.is_start_of(&ss0.pack(&tup)));
134134
}
135135

136136
#[test]

0 commit comments

Comments
 (0)