src/config/serde.rs
29 lines · 678 bytes
1// Structs that impl Into<WhatEverStruct> because WhatEverStruct does not impl Serde
2
3use serde::{Deserialize, Serialize};
4use tui::widgets::BorderType;
5
6#[derive(Serialize, Deserialize, Clone, Copy)]
7pub enum BorderTypeSerde {
8 Plain,
9 Rounded,
10 Double,
11 Thick,
12}
13
14impl Default for BorderTypeSerde {
15 fn default() -> Self {
16 Self::Rounded
17 }
18}
19
20impl Into<BorderType> for BorderTypeSerde {
21 fn into(self) -> BorderType {
22 match self {
23 Self::Plain => BorderType::Plain,
24 Self::Rounded => BorderType::Rounded,
25 Self::Thick => BorderType::Thick,
26 Self::Double => BorderType::Double,
27 }
28 }
29}