• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / catalyst-libs / 16618685382

pending completion
16618685382

Pull #419

github

web-flow
Merge 3cdf83512 into 654b17f07
Pull Request #419: feat(docs): Form Element Documentation

10738 of 16725 relevant lines covered (64.2%)

2361.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/rust/catalyst-types/src/cbor_utils.rs
1
//! CBOR utilities that are highly tied to Catalyst types, so they don't belong to the
2
//! `cbork-utils` crate.
3

4
use std::fmt::Debug;
5

6
use crate::problem_report::ProblemReport;
7

8
/// Adds a "duplicated field" entry to the report and returns true if the field is already
9
/// present in the given found keys list.
10
pub fn report_duplicated_key<T: Debug + PartialEq>(
×
11
    found_keys: &[T], key: &T, index: u64, context: &str, report: &ProblemReport,
×
12
) -> bool {
×
13
    if found_keys.contains(key) {
×
14
        report.duplicate_field(
×
15
            format!("{key:?}").as_str(),
×
16
            format!("Redundant key found in item {}", index.saturating_add(1)).as_str(),
×
17
            context,
×
18
        );
×
19
        return true;
×
20
    }
×
21
    false
×
22
}
×
23

24
/// Adds a "missing field" entry to the report for every required key that isn't present
25
/// in the found keys list.
26
pub fn report_missing_keys<T: Debug + PartialEq>(
×
27
    found_keys: &[T], required_keys: &[T], context: &str, report: &ProblemReport,
×
28
) {
×
29
    for key in required_keys {
×
30
        if !found_keys.contains(key) {
×
31
            report.missing_field(&format!("{key:?}"), context);
×
32
        }
×
33
    }
34
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc