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

pulibrary / bibdata / a2a6a3ec-2ef4-4543-b4c1-576a14a6cef3

15 Aug 2025 04:19PM UTC coverage: 92.556% (-0.09%) from 92.642%
a2a6a3ec-2ef4-4543-b4c1-576a14a6cef3

Pull #2856

circleci

christinach
Write alma_code_start_22? in Rust

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>
Pull Request #2856: Write alma_code_start_22? in Rust

2 of 9 new or added lines in 3 files covered. (22.22%)

6988 of 7550 relevant lines covered (92.56%)

400.65 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 genre;
9
pub mod language;
10
pub mod note;
11
pub mod record_facet_mapping;
12

13
pub use string_normalize::trim_punctuation;
14

NEW
15
pub fn alma_code_start_22(code: String) -> bool {
×
NEW
16
    code.starts_with("22") && code.ends_with("06421")
×
NEW
17
}
×
18
pub fn genres(record_string: String) -> Result<Vec<String>, magnus::Error> {
×
19
    let record = get_record(&record_string)?;
×
20
    Ok(genre::genres(&record))
×
21
}
×
22

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

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

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

46
pub fn strip_non_numeric(string: String) -> String {
×
47
    string_normalize::strip_non_numeric(&string)
×
48
}
×
49

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