oni_comb_parser_rs/internal/parser_impl/
logging_parser_impl.rs

1use crate::core::Parser;
2use crate::extension::parser::LoggingParser;
3use crate::extension::parsers::{LogLevel, LoggingParsers};
4use crate::internal::ParsersImpl;
5use std::fmt::Debug;
6
7impl<'a, I, A> LoggingParser<'a> for Parser<'a, I, A> {
8  fn log(self, name: &'a str, log_level: LogLevel) -> Self::P<'a, Self::Input, Self::Output>
9  where
10    Self::Input: Debug,
11    Self::Output: Debug + 'a, {
12    ParsersImpl::log(self, name, log_level)
13  }
14
15  fn debug(self, name: &'a str) -> Self::P<'a, Self::Input, Self::Output>
16  where
17    Self::Input: Debug,
18    Self::Output: Debug + 'a, {
19    ParsersImpl::log(self, name, LogLevel::Debug)
20  }
21
22  fn info(self, name: &'a str) -> Self::P<'a, Self::Input, Self::Output>
23  where
24    Self::Input: Debug,
25    Self::Output: Debug + 'a, {
26    ParsersImpl::log(self, name, LogLevel::Info)
27  }
28
29  fn warn(self, name: &'a str) -> Self::P<'a, Self::Input, Self::Output>
30  where
31    Self::Input: Debug,
32    Self::Output: Debug + 'a, {
33    ParsersImpl::log(self, name, LogLevel::Warn)
34  }
35
36  fn error(self, name: &'a str) -> Self::P<'a, Self::Input, Self::Output>
37  where
38    Self::Input: Debug,
39    Self::Output: Debug + 'a, {
40    ParsersImpl::log(self, name, LogLevel::Err)
41  }
42
43  fn name(self, name: &'a str) -> Self::P<'a, Self::Input, Self::Output>
44  where
45    Self::Input: Debug,
46    Self::Output: Debug + 'a, {
47    ParsersImpl::name(self, name)
48  }
49}