nichlink_run_method/runtime/trace/locals/local_value.rs
1//! A value captured or inferred for a single invocation.
2//! 单次调用中捕获或推断的值。
3
4use crate::registry_core::declaration::SourceLocation;
5
6use super::local_kind::LocalKind;
7use super::observation::Observation;
8
9/// A value captured or inferred for a single invocation.
10/// 单次调用中捕获或推断的值。
11///
12/// `observation` is `Unobserved` for MIR-only locals. Such values describe a
13/// possible binding and never claim that a runtime value was seen.
14/// `observation` 为 `Unobserved` 时表示仅由 MIR 推断,不能当作运行时实值。
15#[derive(Clone, Debug, PartialEq, Eq)]
16pub struct LocalValue {
17 /// The trace-local id; equal ids mean the same captured value.
18 /// 追踪内的局部 id;id 相等即同一个已捕获值。
19 pub id: u64,
20 /// The name used in output, `function::name` for inferred locals.
21 /// 输出中使用的名称;推断局部值为 `function::name`。
22 pub name: String,
23 /// The rendered type name reported by the recorder.
24 /// 记录方给出的渲染后类型名。
25 pub type_name: String,
26 /// The rendered value, `<not observed>` for MIR-only locals.
27 /// 渲染后的值;仅由 MIR 得出的局部值为 `<not observed>`。
28 pub value: String,
29 /// The role this value plays in its invocation.
30 /// 该值在其调用中扮演的角色。
31 pub kind: LocalKind,
32 /// Where the value was recorded or inferred.
33 /// 该值被记录或推断的位置。
34 pub source: SourceLocation,
35 /// The enclosing frame, `None` when recorded outside every traced call.
36 /// 所属调用帧;在任何被追踪调用之外记录时为 `None`。
37 pub frame_id: Option<u64>,
38 /// Whether the value was observed at runtime or inferred statically.
39 /// 该值是运行时观测到的还是静态推断出来的。
40 pub observation: Observation,
41}