rune_framework/
context.rs1use std::collections::HashMap;
4
5use tokio_util::sync::CancellationToken;
6
7#[derive(Debug, Clone)]
9pub struct RuneContext {
10 pub rune_name: String,
12 pub request_id: String,
14 pub context: HashMap<String, String>,
16 pub cancellation: CancellationToken,
18}
19
20impl RuneContext {
21 pub fn trace_id(&self) -> Option<&str> {
22 self.context.get("trace_id").map(String::as_str)
23 }
24
25 pub fn parent_request_id(&self) -> Option<&str> {
26 self.context.get("parent_request_id").map(String::as_str)
27 }
28}