Struct inferno::flamegraph::color::PaletteMap[][src]

pub struct PaletteMap(_);

Mapping of the association between a function name and the color used when drawing information from this function.

Implementations

impl PaletteMap[src]

pub fn get(&self, func: &str) -> Option<Color>[src]

Returns the color value corresponding to the given function name.

pub fn insert<S: ToString>(&mut self, func: S, color: Color) -> Option<Color>[src]

Inserts a function name/color pair in the map.

pub fn iter(&self) -> impl Iterator<Item = (&str, Color)>[src]

Provides an iterator over the elements of the map.

pub fn from_reader(reader: &mut dyn BufRead) -> Result<Self>[src]

Builds a mapping based on the inputs given by the reader.

The reader should provide name/color pairs as text input, each pair separated by a line separator.

Each line should follow the format: NAME->rgb(RED, GREEN, BLUE) where NAME is the function name, and RED, GREEN, BLUE integer values between 0 and 255 included. Any line which does not follow the previous format will be ignored.

This function will propagate any std::io::Error returned by the given reader.

pub fn to_writer(&self, writer: &mut dyn Write) -> Result<()>[src]

Writes the palette map using the given writer. The output content will follow the same format described in [from_stream()] The name/color pairs will be sorted by name in lexicographic order.

pub fn load_from_file_or_empty(path: &dyn AsRef<Path>) -> Result<Self>[src]

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 save_to_file(&self, path: &dyn AsRef<Path>) -> Result<()>[src]

Utility function to save a palette map to a file.

The file content will follow the format described in [from_stream()].

Trait Implementations

impl Clone for PaletteMap[src]

impl Debug for PaletteMap[src]

impl Default for PaletteMap[src]

impl Eq for PaletteMap[src]

impl PartialEq<PaletteMap> for PaletteMap[src]

impl StructuralEq for PaletteMap[src]

impl StructuralPartialEq for PaletteMap[src]

Auto Trait Implementations

impl RefUnwindSafe for PaletteMap

impl Send for PaletteMap

impl Sync for PaletteMap

impl Unpin for PaletteMap

impl UnwindSafe for PaletteMap

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.