Trait sampling::histogram::BinDisplay
source · pub trait BinDisplay {
type BinEntry;
// Required methods
fn display_bin_iter(&self) -> Box<dyn Iterator<Item = Self::BinEntry> + '_>;
fn write_bin<W: Write>(entry: &Self::BinEntry, writer: W) -> Result<()>;
fn write_header<W: Write>(&self, writer: W) -> Result<()>;
}
Expand description
Trait used to display bins
- This is, e.g., used by the glue writers to write the bins of the merged results
Required Associated Types§
Required Methods§
sourcefn display_bin_iter(&self) -> Box<dyn Iterator<Item = Self::BinEntry> + '_>
fn display_bin_iter(&self) -> Box<dyn Iterator<Item = Self::BinEntry> + '_>
Iterator over all the bins
- you might require to use this if you are working with generics
- if you are working with a specific type there is usually a more efficient implementation
that did not require the usage of dynamic traits (
dyn
) and that are thus more efficient, consider using those instead
sourcefn write_bin<W: Write>(entry: &Self::BinEntry, writer: W) -> Result<()>
fn write_bin<W: Write>(entry: &Self::BinEntry, writer: W) -> Result<()>
For writing a bin
- How to write a bin to a file? If a bin consists, e.g., of an exclusive and inclusive border this might require the writing of two values. It could also be a single value instead. It should be something the user expects from your binning, see write header
sourcefn write_header<W: Write>(&self, writer: W) -> Result<()>
fn write_header<W: Write>(&self, writer: W) -> Result<()>
Writing the header of the bin
- This is intended to name, e.g., a column in a file. Output could be “SingleBin” or “BinBorderExclusive BinBorderInclusive” and so on
Object Safety§
This trait is not object safe.