(timestamp: Timestamp, event: SrcEvent)
| 82 | } |
| 83 | |
| 84 | pub fn event(timestamp: Timestamp, event: SrcEvent) -> Event { |
| 85 | match event { |
| 86 | SrcEvent::Breakpoint { |
| 87 | breakpoint_id, |
| 88 | thread_id, |
| 89 | frame_id, |
| 90 | reason, |
| 91 | locals, |
| 92 | } => { |
| 93 | let thread_id = thread_id as i64; |
| 94 | let frame_id = frame_id as i64; |
| 95 | let data = json_stringify(&locals); |
| 96 | let mut pretty = String::new(); |
| 97 | let mut is_error = false; |
| 98 | write!(pretty, "(").unwrap(); |
| 99 | if !locals.is_empty() { |
| 100 | write!(pretty, "\n").unwrap(); |
| 101 | } |
| 102 | for (name, value) in locals { |
| 103 | write!(pretty, "{name}: {value:#},\n").unwrap(); |
| 104 | is_error |= value_is_error(&value); |
| 105 | } |
| 106 | write!(pretty, ")").unwrap(); |
| 107 | let event_type = match reason { |
| 108 | Reason::Breakpoint => EventType::Breakpoint, |
| 109 | Reason::FutureEnter => EventType::FutureEnter, |
| 110 | Reason::FutureExit => EventType::FutureExit, |
| 111 | Reason::Panic => { |
| 112 | is_error = true; |
| 113 | EventType::Panic |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | Event { |
| 118 | id: NotSet, |
| 119 | breakpoint_id: Set(breakpoint_id), |
| 120 | thread_id: Set(thread_id), |
| 121 | frame_id: Set(frame_id), |
| 122 | parent_frame_id: NotSet, |
| 123 | stack_pointer: Set(None), |
| 124 | function_name: Set(None), |
| 125 | event_type: Set(event_type), |
| 126 | timestamp: Set(timestamp), |
| 127 | data: Set(data), |
| 128 | pretty: Set(pretty), |
| 129 | is_error: Set(is_error), |
| 130 | } |
| 131 | } |
| 132 | SrcEvent::FunctionCall { |
| 133 | breakpoint_id, |
| 134 | thread_id, |
| 135 | frame_id, |
| 136 | stack_pointer, |
| 137 | function_name, |
| 138 | arguments, |
| 139 | } => { |
| 140 | let thread_id = thread_id as i64; |
| 141 | let frame_id = frame_id as i64; |
no test coverage detected