MCPcopy Create free account
hub / github.com/hashintel/hash / debug_context

Function debug_context

libs/error-stack/src/fmt/mod.rs:780–803  ·  view source on GitHub ↗
(context: &(dyn Error + Send + Sync + 'static), mode: ColorMode)

Source from the content-addressed store, hash-verified

778}
779
780fn debug_context(context: &(dyn Error + Send + Sync + 'static), mode: ColorMode) -> Lines {
781 context
782 .to_string()
783 .lines()
784 .map(ToOwned::to_owned)
785 .enumerate()
786 .map(|(idx, value)| {
787 if idx == 0 {
788 let mut style = Style::new();
789
790 if mode == ColorMode::Color || mode == ColorMode::Emphasis {
791 style.set_display(DisplayStyle::new().with_bold(true));
792 }
793
794 Line::new().push(Instruction::Value { value, style })
795 } else {
796 Line::new().push(Instruction::Value {
797 value,
798 style: Style::new(),
799 })
800 }
801 })
802 .collect()
803}
804
805struct Opaque(usize);
806

Callers 1

debug_frameFunction · 0.85

Calls 5

collectMethod · 0.80
set_displayMethod · 0.80
with_boldMethod · 0.80
pushMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected