sz_rust_sdk/core/
diagnostic.rs1use crate::{
4 error::SzResult,
5 ffi_call_diagnostic, process_diagnostic_result,
6 traits::SzDiagnostic,
7 types::{FeatureId, JsonString},
8};
9
10pub struct SzDiagnosticCore;
15
16impl SzDiagnosticCore {
17 pub fn new() -> SzResult<Self> {
18 Ok(Self)
19 }
20
21 pub fn new_with_params(
22 _module_name: &str,
23 _ini_params: &str,
24 _verbose_logging: bool,
25 ) -> SzResult<Self> {
26 Self::new()
27 }
28}
29
30impl SzDiagnostic for SzDiagnosticCore {
31 fn check_repository_performance(&self, seconds_to_run: i64) -> SzResult<JsonString> {
32 let result =
33 unsafe { crate::ffi::SzDiagnostic_checkRepositoryPerformance_helper(seconds_to_run) };
34 process_diagnostic_result!(result)
35 }
36
37 fn get_feature(&self, feature_id: FeatureId) -> SzResult<JsonString> {
38 let result = unsafe { crate::ffi::SzDiagnostic_getFeature_helper(feature_id) };
39 process_diagnostic_result!(result)
40 }
41
42 fn get_repository_info(&self) -> SzResult<JsonString> {
43 let result = unsafe { crate::ffi::SzDiagnostic_getRepositoryInfo_helper() };
44 process_diagnostic_result!(result)
45 }
46
47 fn purge_repository(&self) -> SzResult<()> {
48 ffi_call_diagnostic!(crate::ffi::SzDiagnostic_purgeRepository());
49 Ok(())
50 }
51}