pub trait Collapse {
// Required methods
fn collapse<R, W>(&mut self, reader: R, writer: W) -> Result<()>
where R: BufRead,
W: Write;
fn is_applicable(&mut self, input: &str) -> Option<bool>;
// Provided methods
fn collapse_file<P, W>(
&mut self,
infile: Option<P>,
writer: W,
) -> Result<()>
where P: AsRef<Path>,
W: Write { ... }
fn collapse_file_to_stdout<P>(&mut self, infile: Option<P>) -> Result<()>
where P: AsRef<Path> { ... }
}Expand description
The abstract behavior of stack collapsing.
Implementors of this trait are providing a way to take the stack traces produced by a
particular profiler’s output (like perf script) and produce lines in the folded stack format
expected by crate::flamegraph::from_lines.
See also the crate-level documentation for details.
Required Methods§
Sourcefn collapse<R, W>(&mut self, reader: R, writer: W) -> Result<()>
fn collapse<R, W>(&mut self, reader: R, writer: W) -> Result<()>
Collapses the contents of the provided reader and writes folded stack lines to the
provided writer.
Sourcefn is_applicable(&mut self, input: &str) -> Option<bool>
fn is_applicable(&mut self, input: &str) -> Option<bool>
Returns whether this implementation is appropriate for the given input.
Nonemeans “not sure – need more input”Some(true)means “yes, this implementation should work with this string”Some(false)means “no, this implementation definitely won’t work”
Provided Methods§
Sourcefn collapse_file<P, W>(&mut self, infile: Option<P>, writer: W) -> Result<()>
fn collapse_file<P, W>(&mut self, infile: Option<P>, writer: W) -> Result<()>
Collapses the contents of the provided file (or of STDIN if infile is None) and
writes folded stack lines to provided writer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.