#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Graphics {
pub horizontal: char,
pub vertical: char,
pub junction: char,
pub tip: char,
pub end: char,
}
impl Graphics {
pub const BLANK: Self = Self::new().all(' ');
pub const ASCII: Self = Self::new()
.horizontal('-')
.vertical('|')
.junction('+')
.tip('-')
.end('`');
pub const LIGHT: Self = Self::new()
.horizontal('─')
.vertical('│')
.junction('├')
.tip('─')
.end('└');
pub const LIGHT_DOTTED: Self = Self::new()
.horizontal('╌')
.vertical('╎')
.junction('├')
.tip('─')
.end('└');
pub const LIGHT_ROUNDED: Self = Self::new()
.horizontal('─')
.vertical('│')
.junction('├')
.tip('─')
.end('╰');
pub const LIGHT_DOTTED_ROUNDED: Self = Self::new()
.horizontal('╌')
.vertical('╎')
.junction('├')
.tip('─')
.end('╰');
pub const DOUBLE: Self = Self::new()
.horizontal('═')
.vertical('║')
.junction('╠')
.tip('━')
.end('╚');
pub const HEAVY: Self = Self::new()
.horizontal('━')
.vertical('┃')
.junction('┣')
.tip('━')
.end('┗');
pub const HEAVY_DOTTED: Self = Self::new()
.horizontal('╍')
.vertical('╏')
.junction('┣')
.tip('━')
.end('┗');
}
impl Graphics {
pub const fn new() -> Self {
Self {
horizontal: '─',
vertical: '│',
junction: '├',
tip: '─',
end: '└',
}
}
pub const fn horizontal(mut self, c: char) -> Self {
self.horizontal = c;
self
}
pub const fn vertical(mut self, c: char) -> Self {
self.vertical = c;
self
}
pub const fn junction(mut self, c: char) -> Self {
self.junction = c;
self
}
pub const fn tip(mut self, c: char) -> Self {
self.tip = c;
self
}
pub const fn end(mut self, c: char) -> Self {
self.end = c;
self
}
pub const fn all(mut self, c: char) -> Self {
self.horizontal = c;
self.vertical = c;
self.junction = c;
self.tip = c;
self.end = c;
self
}
}
impl Default for Graphics {
fn default() -> Self {
Self::new()
}
}