Skip to main content

charon_error/error_formating/
span.rs

1use crate::{
2    ErrorAttachment, ErrorSensitivityLabel, ResultER,
3    error_formating::error_fmt::{ErrorFmt, ErrorFmtSettings, ErrorFormatObj},
4};
5use std::collections::HashMap;
6use tracing::instrument;
7
8impl ErrorFmt for HashMap<String, Box<ErrorSensitivityLabel<ErrorAttachment>>> {
9    #[instrument]
10    fn create_format_obj(&self, _settings: ErrorFmtSettings) -> ResultER<ErrorFormatObj> {
11        // All Level of Details converter in same way.
12        Ok(ErrorFormatObj::Object(
13            self.iter()
14                .map(|(key, att)| (key.clone(), ErrorFormatObj::String(att.to_string())))
15                .collect(),
16        ))
17    }
18}