relay_event_normalization/
legacy.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::mem;

use relay_event_schema::processor::{ProcessingResult, ProcessingState, Processor};
use relay_event_schema::protocol::{DebugId, DebugImage, NativeDebugImage};
use relay_protocol::{Annotated, Meta};

/// Converts legacy data structures to current format.
pub struct LegacyProcessor;

impl Processor for LegacyProcessor {
    fn process_debug_image(
        &mut self,
        image: &mut DebugImage,
        _meta: &mut Meta,
        _state: &ProcessingState<'_>,
    ) -> ProcessingResult {
        if let DebugImage::Apple(ref mut apple) = image {
            let native = NativeDebugImage {
                code_id: Annotated::empty(),
                code_file: mem::replace(&mut apple.name, Annotated::empty()).map_value(From::from),
                debug_id: mem::replace(&mut apple.uuid, Annotated::empty())
                    .map_value(DebugId::from),
                debug_file: Annotated::empty(),
                debug_checksum: Annotated::empty(),
                arch: mem::replace(&mut apple.arch, Annotated::empty()),
                image_addr: mem::replace(&mut apple.image_addr, Annotated::empty()),
                image_size: mem::replace(&mut apple.image_size, Annotated::empty()),
                image_vmaddr: mem::replace(&mut apple.image_vmaddr, Annotated::empty()),
                other: mem::take(&mut apple.other),
            };

            *image = DebugImage::MachO(Box::new(native));
        }

        Ok(())
    }
}