docutils_core/
settings.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub struct Settings {
8 pub report_level: u8,
9 pub halt_level: u8,
10 pub writer_name: WriterName,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum WriterName {
15 Html5,
16 PseudoXml,
17 Null,
18}
19
20impl Default for Settings {
21 fn default() -> Self {
22 Self {
23 report_level: 2,
24 halt_level: 4,
25 writer_name: WriterName::Html5,
26 }
27 }
28}
29
30impl Settings {
31 pub fn halt_on(&self, level: u8) -> bool {
32 level >= self.halt_level
33 }
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
38pub struct Halt {
39 pub level: u8,
40 pub message: String,
41}
42
43impl std::fmt::Display for Halt {
44 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45 write!(f, "halted at level {}: {}", self.level, self.message)
46 }
47}
48
49impl std::error::Error for Halt {}