Trait color_eyre::section::SectionExt[][src]

pub trait SectionExt: Sized {
    fn header<C>(self, header: C) -> IndentedSection<C, Self>
    where
        C: Display + Send + Sync + 'static
; }

Extension trait for constructing sections with commonly used formats

Required methods

fn header<C>(self, header: C) -> IndentedSection<C, Self> where
    C: Display + Send + Sync + 'static, 
[src]

Add a header to a Section and indent the body

Details

Bodies are always indented to the same level as error messages and spans. The header is not printed if the display impl of the body produces no output.

Examples

use color_eyre::{eyre::eyre, Help, SectionExt, eyre::Report};

let all_in_header = "header\n   body\n   body";
let report = Err::<(), Report>(eyre!("an error occurred"))
    .section(all_in_header)
    .unwrap_err();

let just_header = "header";
let just_body = "body\nbody";
let report2 = Err::<(), Report>(eyre!("an error occurred"))
    .section(just_body.header(just_header))
    .unwrap_err();

assert_eq!(format!("{:?}", report), format!("{:?}", report2))
Loading content...

Implementors

impl<T> SectionExt for T where
    T: Display + Send + Sync + 'static, 
[src]

Loading content...