Skip to main content

libdd_crashtracker/crash_info/
experimental.rs

1// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3use crate::runtime_callback::RuntimeStack;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7use super::unknown_value::UnknownValue;
8
9#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
10pub struct Experimental {
11    #[serde(default, skip_serializing_if = "Vec::is_empty")]
12    pub additional_tags: Vec<String>,
13    #[serde(default, skip_serializing_if = "Option::is_none")]
14    pub ucontext: Option<String>,
15    #[serde(default, skip_serializing_if = "Option::is_none")]
16    pub runtime_stack: Option<RuntimeStack>,
17}
18
19impl Experimental {
20    pub fn new() -> Self {
21        Self::default()
22    }
23
24    pub fn with_additional_tags(mut self, additional_tags: Vec<String>) -> Self {
25        self.additional_tags = additional_tags;
26        self
27    }
28
29    pub fn with_ucontext(mut self, ucontext: String) -> Self {
30        self.ucontext = Some(ucontext);
31        self
32    }
33
34    pub fn with_runtime_stack(mut self, runtime_stack: RuntimeStack) -> Self {
35        self.runtime_stack = Some(runtime_stack);
36        self
37    }
38}
39
40impl UnknownValue for Experimental {
41    fn unknown_value() -> Self {
42        Self {
43            additional_tags: vec![],
44            ucontext: None,
45            runtime_stack: None,
46        }
47    }
48}