@@ -14,6 +14,7 @@ mod data_iter;
14
14
pub mod filter;
15
15
16
16
type LogRowIdxFieldName < ' a > = Option < & ' a String > ;
17
+ type RowSlice < ' a > = & ' a [ ( String , String ) ] ;
17
18
18
19
#[ derive( serde:: Deserialize , serde:: Serialize , Default , Debug , PartialEq , Eq ) ]
19
20
#[ serde( default ) ]
@@ -69,7 +70,7 @@ impl LogRow {
69
70
}
70
71
}
71
72
72
- pub fn as_slice ( & mut self , common_fields : & BTreeSet < String > ) -> & [ ( String , String ) ] {
73
+ pub fn as_slice ( & mut self , common_fields : & BTreeSet < String > ) -> RowSlice < ' _ > {
73
74
self . ensure_cache_is_populated ( common_fields) ;
74
75
75
76
& self
@@ -160,7 +161,7 @@ impl Data {
160
161
pub fn selected_row_data_as_slice (
161
162
& mut self ,
162
163
common_fields : & BTreeSet < String > ,
163
- ) -> Option < & [ ( String , String ) ] > {
164
+ ) -> Option < RowSlice < ' _ > > {
164
165
let selected_row_index = self . selected_row ?;
165
166
let real_index = self . get_real_index ( selected_row_index) ;
166
167
Some ( self . rows [ real_index] . as_slice ( common_fields) )
@@ -169,7 +170,7 @@ impl Data {
169
170
pub fn selected_row_data_as_slice_with_filter_matching_fields (
170
171
& mut self ,
171
172
common_fields : & BTreeSet < String > ,
172
- ) -> Option < ( & [ ( String , String ) ] , Vec < usize > ) > {
173
+ ) -> Option < ( RowSlice < ' _ > , Vec < usize > ) > {
173
174
// Collect other needed info before taking mutable borrow to appease the borrow checker (couldn't find another readable way)
174
175
let is_filtered = self . is_filtered ( ) ;
175
176
let filter = if is_filtered {
@@ -287,10 +288,7 @@ impl Data {
287
288
}
288
289
289
290
/// If the slice of fields and values matches the filter then the indices of the fields that match are returned or None if it does not match
290
- fn matching_fields (
291
- fields_and_values : & [ ( String , String ) ] ,
292
- filter : & FilterConfig ,
293
- ) -> Option < Vec < usize > > {
291
+ fn matching_fields ( fields_and_values : RowSlice < ' _ > , filter : & FilterConfig ) -> Option < Vec < usize > > {
294
292
let FilterConfig {
295
293
search_key,
296
294
filter_on,
0 commit comments