llama_cpp_bindings/
log_options.rs1#[derive(Default, Debug, Clone)]
3pub struct LogOptions {
4 pub disabled: bool,
5 pub demote_info_to_debug: bool,
6}
7
8impl LogOptions {
9 #[must_use]
12 pub const fn with_logs_enabled(mut self, enabled: bool) -> Self {
13 self.disabled = !enabled;
14
15 self
16 }
17
18 #[must_use]
23 pub const fn with_demote_info_to_debug(mut self, demote: bool) -> Self {
24 self.demote_info_to_debug = demote;
25
26 self
27 }
28}
29
30#[cfg(test)]
31mod tests {
32 use super::LogOptions;
33
34 #[test]
35 fn builder_chain_sets_both_flags() {
36 let options = LogOptions::default()
37 .with_logs_enabled(false)
38 .with_demote_info_to_debug(true);
39
40 assert!(options.disabled);
41 assert!(options.demote_info_to_debug);
42 }
43}