File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,16 @@ impl Subspace {
68
68
/// removed. `unpack` will return an error if the key is not in this Subspace or does not
69
69
/// encode a well-formed Tuple.
70
70
pub fn unpack < T : Tuple > ( & self , key : & [ u8 ] ) -> Result < T , TupleError > {
71
- if !self . covers ( key) {
71
+ if !self . is_start_of ( key) {
72
72
return Err ( TupleError :: InvalidData ) ;
73
73
}
74
74
let key = & key[ self . prefix . len ( ) ..] ;
75
75
Tuple :: decode ( & key)
76
76
}
77
77
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,
79
79
/// 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 {
81
81
key. starts_with ( & self . prefix )
82
82
}
83
83
@@ -124,13 +124,13 @@ mod tests {
124
124
}
125
125
126
126
#[ test]
127
- fn covers ( ) {
127
+ fn is_start_of ( ) {
128
128
let ss0 = Subspace :: new ( & ( 1 , ) ) ;
129
129
let ss1 = Subspace :: new ( & ( 2 , ) ) ;
130
130
let tup = ( 2 , 3 ) ;
131
131
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) ) ) ;
134
134
}
135
135
136
136
#[ test]
You can’t perform that action at this time.
0 commit comments