1 use rustc_data_structures::sync::Lrc; 2 use std::path::PathBuf; 3 4 #[derive(HashStable)] 5 #[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)] 6 pub enum DebuggerVisualizerType { 7 Natvis, 8 GdbPrettyPrinter, 9 } 10 11 /// A single debugger visualizer file. 12 #[derive(HashStable)] 13 #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable)] 14 pub struct DebuggerVisualizerFile { 15 /// The complete debugger visualizer source. 16 pub src: Lrc<[u8]>, 17 /// Indicates which visualizer type this targets. 18 pub visualizer_type: DebuggerVisualizerType, 19 /// The file path to the visualizer file. This is used for reporting 20 /// visualizer files in dep-info. Before it is written to crate metadata, 21 /// the path is erased to `None`, so as not to emit potentially privacy 22 /// sensitive data. 23 pub path: Option<PathBuf>, 24 } 25 26 impl DebuggerVisualizerFile { new(src: Lrc<[u8]>, visualizer_type: DebuggerVisualizerType, path: PathBuf) -> Self27 pub fn new(src: Lrc<[u8]>, visualizer_type: DebuggerVisualizerType, path: PathBuf) -> Self { 28 DebuggerVisualizerFile { src, visualizer_type, path: Some(path) } 29 } 30 path_erased(&self) -> Self31 pub fn path_erased(&self) -> Self { 32 DebuggerVisualizerFile { 33 src: self.src.clone(), 34 visualizer_type: self.visualizer_type, 35 path: None, 36 } 37 } 38 } 39