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