papergrid/config/
vertical_line.rs1#[derive(Debug, Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
3pub struct VerticalLine<T> {
4 pub main: Option<T>,
6 pub intersection: Option<T>,
8 pub top: Option<T>,
10 pub bottom: Option<T>,
12}
13
14impl<T> VerticalLine<T> {
15 pub const fn new(
17 main: Option<T>,
18 intersection: Option<T>,
19 top: Option<T>,
20 bottom: Option<T>,
21 ) -> Self {
22 Self {
23 main,
24 intersection,
25 top,
26 bottom,
27 }
28 }
29
30 pub const fn full(main: T, intersection: T, left: T, right: T) -> Self {
32 Self::new(Some(main), Some(intersection), Some(left), Some(right))
33 }
34
35 pub const fn filled(val: T) -> Self
37 where
38 T: Copy,
39 {
40 Self {
41 main: Some(val),
42 intersection: Some(val),
43 top: Some(val),
44 bottom: Some(val),
45 }
46 }
47
48 pub const fn empty() -> Self {
50 Self::new(None, None, None, None)
51 }
52
53 pub const fn is_empty(&self) -> bool {
55 self.main.is_none()
56 && self.intersection.is_none()
57 && self.top.is_none()
58 && self.bottom.is_none()
59 }
60}