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
64
65
66
67
68
use crate::{
Result, Rudof,
api::shex::ShExOperations,
formats::{ResultShExValidationFormat, ShExValidationSortByMode},
};
use std::io;
/// Builder for `serialize_shex_validation_results` operation.
///
/// Provides a fluent interface for configuring and executing ShEx validation results
/// serialization operations with optional parameters.
pub struct SerializeShexValidationResultsBuilder<'a, W: io::Write> {
rudof: &'a Rudof,
writer: &'a mut W,
shex_validation_sort_order_mode: Option<&'a ShExValidationSortByMode>,
result_shex_validation_format: Option<&'a ResultShExValidationFormat>,
}
impl<'a, W: io::Write> SerializeShexValidationResultsBuilder<'a, W> {
/// Creates a new builder instance.
///
/// This is called internally by `Rudof::serialize_shex_validation_results()` and should not
/// be constructed directly.
pub(crate) fn new(rudof: &'a Rudof, writer: &'a mut W) -> Self {
Self {
rudof,
writer,
shex_validation_sort_order_mode: None,
result_shex_validation_format: None,
}
}
/// Sets the sorting mode for validation results.
///
/// # Arguments
///
/// * `shex_validation_sort_order_mode` - The sorting mode to apply to validation results
pub fn with_shex_validation_sort_order_mode(
mut self,
shex_validation_sort_order_mode: &'a ShExValidationSortByMode,
) -> Self {
self.shex_validation_sort_order_mode = Some(shex_validation_sort_order_mode);
self
}
/// Sets the output format for validation results.
///
/// # Arguments
///
/// * `result_shex_validation_format` - The format in which to serialize validation results
pub fn with_result_shex_validation_format(
mut self,
result_shex_validation_format: &'a ResultShExValidationFormat,
) -> Self {
self.result_shex_validation_format = Some(result_shex_validation_format);
self
}
/// Executes the validation results serialization operation with the configured parameters.
pub fn execute(self) -> Result<()> {
<Rudof as ShExOperations>::serialize_shex_validation_results(
self.rudof,
self.shex_validation_sort_order_mode,
self.result_shex_validation_format,
self.writer,
)
}
}