5
5
6
6
7
7
# BACKCOMPAT: rust 1.35
8
- def is_hashbrown_hashmap (hash_map ) :
8
+ def is_hashbrown_hashmap (hash_map : lldb . SBValue ) -> bool :
9
9
return len (hash_map .type .fields ) == 1
10
10
11
11
12
- def classify_rust_type (type ) :
12
+ def classify_rust_type (type : lldb . SBType ) -> str :
13
13
type_class = type .GetTypeClass ()
14
14
if type_class == lldb .eTypeClassStruct :
15
15
return classify_struct (type .name , type .fields )
@@ -19,106 +19,104 @@ def classify_rust_type(type):
19
19
return RustType .OTHER
20
20
21
21
22
- def summary_lookup (valobj , dict ):
23
- # type: (SBValue, dict) -> str
22
+ def summary_lookup (valobj : lldb .SBValue , _dict : LLDBOpaque ) -> str :
24
23
"""Returns the summary provider for the given value"""
25
24
rust_type = classify_rust_type (valobj .GetType ())
26
25
27
26
if rust_type == RustType .STD_STRING :
28
- return StdStringSummaryProvider (valobj , dict )
27
+ return StdStringSummaryProvider (valobj , _dict )
29
28
if rust_type == RustType .STD_OS_STRING :
30
- return StdOsStringSummaryProvider (valobj , dict )
29
+ return StdOsStringSummaryProvider (valobj , _dict )
31
30
if rust_type == RustType .STD_STR :
32
- return StdStrSummaryProvider (valobj , dict )
31
+ return StdStrSummaryProvider (valobj , _dict )
33
32
34
33
if rust_type == RustType .STD_VEC :
35
- return SizeSummaryProvider (valobj , dict )
34
+ return SizeSummaryProvider (valobj , _dict )
36
35
if rust_type == RustType .STD_VEC_DEQUE :
37
- return SizeSummaryProvider (valobj , dict )
36
+ return SizeSummaryProvider (valobj , _dict )
38
37
if rust_type == RustType .STD_SLICE :
39
- return SizeSummaryProvider (valobj , dict )
38
+ return SizeSummaryProvider (valobj , _dict )
40
39
41
40
if rust_type == RustType .STD_HASH_MAP :
42
- return SizeSummaryProvider (valobj , dict )
41
+ return SizeSummaryProvider (valobj , _dict )
43
42
if rust_type == RustType .STD_HASH_SET :
44
- return SizeSummaryProvider (valobj , dict )
43
+ return SizeSummaryProvider (valobj , _dict )
45
44
46
45
if rust_type == RustType .STD_RC :
47
- return StdRcSummaryProvider (valobj , dict )
46
+ return StdRcSummaryProvider (valobj , _dict )
48
47
if rust_type == RustType .STD_ARC :
49
- return StdRcSummaryProvider (valobj , dict )
48
+ return StdRcSummaryProvider (valobj , _dict )
50
49
51
50
if rust_type == RustType .STD_REF :
52
- return StdRefSummaryProvider (valobj , dict )
51
+ return StdRefSummaryProvider (valobj , _dict )
53
52
if rust_type == RustType .STD_REF_MUT :
54
- return StdRefSummaryProvider (valobj , dict )
53
+ return StdRefSummaryProvider (valobj , _dict )
55
54
if rust_type == RustType .STD_REF_CELL :
56
- return StdRefSummaryProvider (valobj , dict )
55
+ return StdRefSummaryProvider (valobj , _dict )
57
56
58
57
if rust_type == RustType .STD_NONZERO_NUMBER :
59
- return StdNonZeroNumberSummaryProvider (valobj , dict )
58
+ return StdNonZeroNumberSummaryProvider (valobj , _dict )
60
59
61
60
if rust_type == RustType .STD_PATHBUF :
62
- return StdPathBufSummaryProvider (valobj , dict )
61
+ return StdPathBufSummaryProvider (valobj , _dict )
63
62
if rust_type == RustType .STD_PATH :
64
- return StdPathSummaryProvider (valobj , dict )
63
+ return StdPathSummaryProvider (valobj , _dict )
65
64
66
65
return ""
67
66
68
67
69
- def synthetic_lookup (valobj , dict ):
70
- # type: (SBValue, dict) -> object
68
+ def synthetic_lookup (valobj : lldb .SBValue , _dict : LLDBOpaque ) -> object :
71
69
"""Returns the synthetic provider for the given value"""
72
70
rust_type = classify_rust_type (valobj .GetType ())
73
71
74
72
if rust_type == RustType .STRUCT :
75
- return StructSyntheticProvider (valobj , dict )
73
+ return StructSyntheticProvider (valobj , _dict )
76
74
if rust_type == RustType .STRUCT_VARIANT :
77
- return StructSyntheticProvider (valobj , dict , is_variant = True )
75
+ return StructSyntheticProvider (valobj , _dict , is_variant = True )
78
76
if rust_type == RustType .TUPLE :
79
- return TupleSyntheticProvider (valobj , dict )
77
+ return TupleSyntheticProvider (valobj , _dict )
80
78
if rust_type == RustType .TUPLE_VARIANT :
81
- return TupleSyntheticProvider (valobj , dict , is_variant = True )
79
+ return TupleSyntheticProvider (valobj , _dict , is_variant = True )
82
80
if rust_type == RustType .EMPTY :
83
- return EmptySyntheticProvider (valobj , dict )
81
+ return EmptySyntheticProvider (valobj , _dict )
84
82
if rust_type == RustType .REGULAR_ENUM :
85
83
discriminant = valobj .GetChildAtIndex (0 ).GetChildAtIndex (0 ).GetValueAsUnsigned ()
86
- return synthetic_lookup (valobj .GetChildAtIndex (discriminant ), dict )
84
+ return synthetic_lookup (valobj .GetChildAtIndex (discriminant ), _dict )
87
85
if rust_type == RustType .SINGLETON_ENUM :
88
- return synthetic_lookup (valobj .GetChildAtIndex (0 ), dict )
86
+ return synthetic_lookup (valobj .GetChildAtIndex (0 ), _dict )
89
87
if rust_type == RustType .ENUM :
90
- return ClangEncodedEnumProvider (valobj , dict )
88
+ return ClangEncodedEnumProvider (valobj , _dict )
91
89
if rust_type == RustType .STD_VEC :
92
- return StdVecSyntheticProvider (valobj , dict )
90
+ return StdVecSyntheticProvider (valobj , _dict )
93
91
if rust_type == RustType .STD_VEC_DEQUE :
94
- return StdVecDequeSyntheticProvider (valobj , dict )
92
+ return StdVecDequeSyntheticProvider (valobj , _dict )
95
93
if rust_type == RustType .STD_SLICE or rust_type == RustType .STD_STR :
96
- return StdSliceSyntheticProvider (valobj , dict )
94
+ return StdSliceSyntheticProvider (valobj , _dict )
97
95
98
96
if rust_type == RustType .STD_HASH_MAP :
99
97
if is_hashbrown_hashmap (valobj ):
100
- return StdHashMapSyntheticProvider (valobj , dict )
98
+ return StdHashMapSyntheticProvider (valobj , _dict )
101
99
else :
102
- return StdOldHashMapSyntheticProvider (valobj , dict )
100
+ return StdOldHashMapSyntheticProvider (valobj , _dict )
103
101
if rust_type == RustType .STD_HASH_SET :
104
102
hash_map = valobj .GetChildAtIndex (0 )
105
103
if is_hashbrown_hashmap (hash_map ):
106
- return StdHashMapSyntheticProvider (valobj , dict , show_values = False )
104
+ return StdHashMapSyntheticProvider (valobj , _dict , show_values = False )
107
105
else :
108
- return StdOldHashMapSyntheticProvider (hash_map , dict , show_values = False )
106
+ return StdOldHashMapSyntheticProvider (hash_map , _dict , show_values = False )
109
107
110
108
if rust_type == RustType .STD_RC :
111
- return StdRcSyntheticProvider (valobj , dict )
109
+ return StdRcSyntheticProvider (valobj , _dict )
112
110
if rust_type == RustType .STD_ARC :
113
- return StdRcSyntheticProvider (valobj , dict , is_atomic = True )
111
+ return StdRcSyntheticProvider (valobj , _dict , is_atomic = True )
114
112
115
113
if rust_type == RustType .STD_CELL :
116
- return StdCellSyntheticProvider (valobj , dict )
114
+ return StdCellSyntheticProvider (valobj , _dict )
117
115
if rust_type == RustType .STD_REF :
118
- return StdRefSyntheticProvider (valobj , dict )
116
+ return StdRefSyntheticProvider (valobj , _dict )
119
117
if rust_type == RustType .STD_REF_MUT :
120
- return StdRefSyntheticProvider (valobj , dict )
118
+ return StdRefSyntheticProvider (valobj , _dict )
121
119
if rust_type == RustType .STD_REF_CELL :
122
- return StdRefSyntheticProvider (valobj , dict , is_cell = True )
120
+ return StdRefSyntheticProvider (valobj , _dict , is_cell = True )
123
121
124
- return DefaultSyntheticProvider (valobj , dict )
122
+ return DefaultSyntheticProvider (valobj , _dict )
0 commit comments