Skip to content

Commit a2cc701

Browse files
committed
feat: add initial support for tuples, variants and slices
1 parent 4e40209 commit a2cc701

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "runtime_tracing"
3-
version = "0.7.1"
3+
version = "0.8.0"
44
edition = "2021"
55
authors = ["Metacraft Labs Ltd"]
66
description = "A library for the schema and tracing helpers for the CodeTracer db trace format"

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ mod tests {
8383
Place(1),
8484
ValueRecord::Sequence {
8585
elements: vec![ValueRecord::Cell { place: Place(0) }], // #0
86+
is_slice: false,
8687
type_id,
8788
},
8889
);

src/types.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub enum TraceLowLevelEvent {
2828

2929
// events useful for history
3030
BindVariable(BindVariableRecord), // bind a variable to a certain place
31-
Assignment(AssignmentRecord), // assigning or passing by params
32-
DropVariables(Vec<VariableId>), // dropping variables e.g. in the end of scope/heap lifetime
31+
Assignment(AssignmentRecord), // assigning or passing by params
32+
DropVariables(Vec<VariableId>), // dropping variables e.g. in the end of scope/heap lifetime
3333

3434
// experimental modification value tracking events
3535
// probably will be reworked or replaced by the newer
@@ -280,6 +280,9 @@ pub struct VariableRecord {
280280
pub struct TypeRecord {
281281
pub kind: TypeKind,
282282
pub lang_type: String,
283+
// for now only for Struct: TODO eventually
284+
// replace with an enum for TypeRecord, or with more cases
285+
// in TypeSpecificInfo for collections, etc
283286
pub specific_info: TypeSpecificInfo,
284287
}
285288

@@ -338,11 +341,21 @@ pub enum ValueRecord {
338341
Sequence {
339342
elements: Vec<ValueRecord>,
340343
type_id: TypeId,
344+
is_slice: bool,
345+
},
346+
Tuple {
347+
elements: Vec<ValueRecord>,
348+
type_id: TypeId,
341349
},
342350
Struct {
343351
field_values: Vec<ValueRecord>,
344352
type_id: TypeId, // must point to Type with STRUCT kind and TypeSpecificInfo::Struct
345353
},
354+
Variant {
355+
discriminator: String, // TODO: eventually a more specific kind of value/type
356+
contents: Box<ValueRecord>, // usually a Struct or a Tuple
357+
type_id: TypeId,
358+
},
346359
Raw {
347360
r: String,
348361
type_id: TypeId,

0 commit comments

Comments
 (0)