etop_format/table_formats/
unknown_format.rs1use crate::{BinaryFormat, BoolFormat, NumberFormat, StringFormat};
2
3#[derive(Debug, Clone)]
5pub struct UnknownFormat {
6 pub min_width: Option<usize>,
8 pub max_width: Option<usize>,
10}
11
12impl UnknownFormat {
13 pub fn min_width(mut self, width: usize) -> UnknownFormat {
15 self.min_width = Some(width);
16 self
17 }
18
19 pub fn max_width(mut self, width: usize) -> UnknownFormat {
21 self.max_width = Some(width);
22 self
23 }
24}
25
26impl From<UnknownFormat> for NumberFormat {
27 fn from(unknown_format: UnknownFormat) -> Self {
28 NumberFormat::new()
29 .min_width_option(unknown_format.min_width)
30 .max_width_option(unknown_format.max_width)
31 }
32}
33
34impl From<UnknownFormat> for BinaryFormat {
35 fn from(unknown_format: UnknownFormat) -> Self {
36 BinaryFormat::new()
37 .min_width_option(unknown_format.min_width)
38 .max_width_option(unknown_format.max_width)
39 }
40}
41
42impl From<UnknownFormat> for StringFormat {
43 fn from(unknown_format: UnknownFormat) -> Self {
44 StringFormat::new()
45 .min_width_option(unknown_format.min_width)
46 .max_width_option(unknown_format.max_width)
47 }
48}
49
50impl From<UnknownFormat> for BoolFormat {
51 fn from(unknown_format: UnknownFormat) -> Self {
52 BoolFormat::new()
53 .min_width_option(unknown_format.min_width)
54 .max_width_option(unknown_format.max_width)
55 }
56}