From dc5299cfa93ddca306d3e006dc7d037aba61108d Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Thu, 29 May 2025 15:54:54 +0300 Subject: [PATCH] Add Int128 value support --- docs/trace_json_spec.md | 1 + src/lib.rs | 10 ++++++++++ src/types.rs | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/docs/trace_json_spec.md b/docs/trace_json_spec.md index c0b16c3..b050e0f 100644 --- a/docs/trace_json_spec.md +++ b/docs/trace_json_spec.md @@ -189,6 +189,7 @@ A special marker used when a previously emitted `Step` should be ignored. It kee Many events embed `ValueRecord` objects. They all use an internally tagged representation with a `kind` field. The possible variants are: * `Int` – `{ "kind": "Int", "i": number, "type_id": TypeId }` +* `Int128` – `{ "kind": "Int128", "i": number, "type_id": TypeId }` * `Float` – `{ "kind": "Float", "f": number, "type_id": TypeId }` * `Bool` – `{ "kind": "Bool", "b": true|false, "type_id": TypeId }` * `String` – `{ "kind": "String", "text": "...", "type_id": TypeId }` diff --git a/src/lib.rs b/src/lib.rs index b0d6a65..52f508e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -155,4 +155,14 @@ mod tests { assert_eq!(a, b); assert_ne!(a, different); } + + #[test] + fn test_i128_value_record() { + let a = ValueRecord::Int128 { i: 0, type_id: TypeId(0) }; + let b = ValueRecord::Int128 { i: 0, type_id: TypeId(0) }; + let different = ValueRecord::Int128 { i: 1, type_id: TypeId(0) }; + + assert_eq!(a, b); + assert_ne!(a, different); + } } diff --git a/src/types.rs b/src/types.rs index faecc30..6a2b4a9 100644 --- a/src/types.rs +++ b/src/types.rs @@ -334,6 +334,10 @@ pub enum ValueRecord { i: i64, type_id: TypeId, }, + Int128 { + i: i128, + type_id: TypeId, + }, Float { f: f64, type_id: TypeId,