#[derive(Debug, Clone, Default)]
pub struct SummaryOptions {
pub scope: Option<String>,
pub max_depth: Option<usize>,
pub include_stats: bool,
pub include_locations: bool,
pub compact: bool,
}
impl SummaryOptions {
pub fn detailed() -> Self {
Self {
include_stats: true,
include_locations: true,
..Default::default()
}
}
pub fn compact() -> Self {
Self {
compact: true,
include_locations: false,
include_stats: false,
..Default::default()
}
}
pub fn with_scope(mut self, scope: impl Into<String>) -> Self {
self.scope = Some(scope.into());
self
}
pub fn with_max_depth(mut self, depth: usize) -> Self {
self.max_depth = Some(depth);
self
}
}
pub trait ToSummary {
fn to_summary(&self) -> String {
self.to_summary_with_options(&SummaryOptions::default())
}
fn to_summary_with_options(&self, opts: &SummaryOptions) -> String;
}