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

pulibrary / bibdata / 880759a6-1cd8-4c26-ac18-7fa2f37cee33

14 Aug 2025 04:24PM UTC coverage: 92.642% (+0.02%) from 92.625%
880759a6-1cd8-4c26-ac18-7fa2f37cee33

Pull #2849

circleci

sandbergja
Rename module for clarity

Co-authored-by: Christina Chortaria <christinach@users.noreply.github.com>
Pull Request #2849: Refactor format facet code to Rust

325 of 361 new or added lines in 8 files covered. (90.03%)

5 existing lines in 1 file now uncovered.

6988 of 7543 relevant lines covered (92.64%)

429.18 hits per line

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

0.0
/lib/bibdata_rs/src/marc.rs
1
use magnus::exception;
2
use marctk::Record;
3

4
mod string_normalize;
5

6
pub mod control_field;
7
pub mod fixed_field;
8
pub mod record_facet_mapping;
9
pub mod genre;
10
pub mod language;
11
pub mod note;
12

13
pub use string_normalize::trim_punctuation;
14

15
pub fn genres(record_string: String) -> Result<Vec<String>, magnus::Error> {
×
16
    let record = get_record(&record_string)?;
×
17
    Ok(genre::genres(&record))
×
18
}
×
19

20
pub fn original_languages_of_translation(
×
21
    record_string: String,
×
22
) -> Result<Vec<String>, magnus::Error> {
×
23
    let record = get_record(&record_string)?;
×
24
    Ok(language::original_languages_of_translation(&record)
×
25
        .iter()
×
26
        .map(|language| language.english_name.to_owned())
×
27
        .collect())
×
28
}
×
29

30
pub fn access_notes(record_string: String) -> Result<Option<Vec<String>>, magnus::Error> {
×
31
    let record = get_record(&record_string)?;
×
32
    Ok(note::access_notes(&record))
×
33
}
×
34

NEW
35
pub fn format_facets(record_string: String) -> Result<Vec<String>, magnus::Error> {
×
NEW
36
    let record = get_record(&record_string)?;
×
NEW
37
    Ok(record_facet_mapping::format_facets(&record)
×
NEW
38
        .iter()
×
NEW
39
        .map(|facet| format!("{facet}"))
×
NEW
40
        .collect())
×
NEW
41
}
×
42

43
pub fn strip_non_numeric(string: String) -> String {
×
44
    string_normalize::strip_non_numeric(&string)
×
45
}
×
46

47
fn get_record(breaker: &str) -> Result<Record, magnus::Error> {
×
48
    Record::from_breaker(breaker).map_err(|err| {
×
49
        magnus::Error::new(
×
50
            exception::runtime_error(),
×
51
            format!("Found error {} while parsing breaker {}", err, breaker),
×
52
        )
53
    })
×
54
}
×
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