/// Utility function to load a palette map from a file.
///
/// The file content should follow the format described in [from_stream()].
///
/// If the file does not exist, an empty palette map is returned.
Utility function to load a palette map from a file.
The file content should follow the format described in [from_stream()].

If the file does not exist, an empty palette map is returned.
Utility function to load a palette map from a file . The file content should follow the format described in [ from_stream () ] . If the file does not exist an empty palette map is returned .
pub fn load_from_file_or_empty(path: &dyn AsRef<Path>) -> io::Result<Self> {
        // If the file does not exist, it is probably the first call to flamegraph with a consistent
        // palette: there is nothing to load.
        if path.as_ref().exists() {
            let file = File::open(path)?;
            let mut reader = BufReader::new(file);
            PaletteMap::from_reader(&mut reader)
        } else {
            Ok(PaletteMap::default())
        }
    }
pub fn load_from_file_or_empty ( path : & dyn AsRef < Path > ) -> io :: Result < Self > { // If the file does not exist, it is probably the first call to flamegraph with a consistent // palette: there is nothing to load. if path . as_ref ( ) . exists ( ) { let file = File :: open ( path ) ? ; let mut reader = BufReader :: new ( file ) ; PaletteMap :: from_reader ( & mut reader ) } else { Ok ( PaletteMap :: default ( ) ) } }
Utility function to load a palette map from a file.
Utility function to load a palette map from a file .
path
&dyn AsRef<Path>