| 186 | } |
| 187 | |
| 188 | pub fn messages<E>(report: &Report<E>) -> Vec<String> { |
| 189 | report |
| 190 | .frames() |
| 191 | .map(|frame| match frame.kind() { |
| 192 | FrameKind::Context(context) => context.to_string(), |
| 193 | FrameKind::Attachment(AttachmentKind::Printable(attachment)) => attachment.to_string(), |
| 194 | FrameKind::Attachment(AttachmentKind::Opaque(_)) => { |
| 195 | #[cfg(feature = "backtrace")] |
| 196 | if frame.type_id() == TypeId::of::<Backtrace>() { |
| 197 | return String::from("Backtrace"); |
| 198 | } |
| 199 | #[cfg(feature = "spantrace")] |
| 200 | if frame.type_id() == TypeId::of::<SpanTrace>() { |
| 201 | return String::from("SpanTrace"); |
| 202 | } |
| 203 | if frame.type_id() == TypeId::of::<Location>() { |
| 204 | String::from("Location") |
| 205 | } else { |
| 206 | String::from("opaque") |
| 207 | } |
| 208 | } |
| 209 | FrameKind::Attachment(_) => panic!("attachment was not covered"), |
| 210 | }) |
| 211 | .collect() |
| 212 | } |
| 213 | |
| 214 | pub fn frame_kinds<E>(report: &Report<E>) -> Vec<FrameKind<'_>> { |
| 215 | remove_builtin_frames(report).map(Frame::kind).collect() |