1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Field collection traits for managing MARC record field collections.
//!
//! This module provides traits that standardize field collection management
//! across different record types, reducing code duplication.
use crateField;
/// A trait for managing a collection of MARC fields.
///
/// This trait defines the operations needed to manage field collections
/// in a consistent way across different record types. Each implementation
/// manages a specific `Vec<Field>` collection.
///
/// # Examples
///
/// ```ignore
/// impl FieldCollection for AuthorityRecord {
/// fn add_field_to_collection(&mut self, field: Field, name: &str) {
/// match name {
/// "see_from" => self.tracings_see_from.push(field),
/// "see_also" => self.tracings_see_also.push(field),
/// _ => {}
/// }
/// }
///
/// fn get_collection(&self, name: &str) -> Option<&[Field]> {
/// match name {
/// "see_from" => Some(&self.tracings_see_from),
/// "see_also" => Some(&self.tracings_see_also),
/// _ => None
/// }
/// }
/// }
/// ```
/// Helper to reduce boilerplate for simple field accessor pairs.
///
/// This provides a standardized way to implement simple add/get pairs
/// for field collections.
;