| 1 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#; |
| 2 | use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#}; |
| 3 | |
| 4 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 5 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 6 | #[cfg_attr(test, derive(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:))] |
| 7 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType# { |
| 8 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 9 | Defaultrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Default#, |
| 10 | Roundedrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Rounded#, |
| 11 | Doublerust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Double#, |
| 12 | Thickrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Thick#, |
| 13 | } |
| 14 | |
| 15 | impl<'de> Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> for WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType# { |
| 16 | fn deserializerust-analyzer cargo bottom 0.14.9 options/config/style/borders/impl#[WidgetBorderType][`Deserialize<'de>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo bottom 0.14.9 options/config/style/borders/impl#[WidgetBorderType][`Deserialize<'de>`], D::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#> |
| 17 | where |
| 18 | D: serderust-analyzer cargo serde 1.0.228 crate/::Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de>, |
| 19 | { |
| 20 | let value = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::deserializerust-analyzer cargo serde_core 1.0.228 de/impls/impl#[String][`Deserialize<'de>`]deserialize().(deserializer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().(); |
| 21 | match value.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() { |
| 22 | "default" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Defaultrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Default#), |
| 23 | "rounded" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Roundedrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Rounded#), |
| 24 | "double" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Doublerust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Double#), |
| 25 | "thick" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Thickrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Thick#), |
| 26 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/::Errorrust-analyzer cargo serde_core 1.0.228 de/Error#::customrust-analyzer cargo serde_core 1.0.228 de/Error#custom().( |
| 27 | "doesn't match any widget border type", |
| 28 | )), |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#> for BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType# { |
| 34 | fn fromrust-analyzer cargo bottom 0.14.9 options/config/style/borders/impl#[BorderType][`From<WidgetBorderType>`]from().(value: WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#) -> Selfrust-analyzer cargo bottom 0.14.9 options/config/style/borders/impl#[BorderType][`From<WidgetBorderType>`] { |
| 35 | match value { |
| 36 | WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Defaultrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Default# => BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#::Plainrust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#Plain#, |
| 37 | WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Roundedrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Rounded# => BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#::Roundedrust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#Rounded#, |
| 38 | WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Doublerust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Double# => BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#::Doublerust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#Double#, |
| 39 | WidgetBorderTyperust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#::Thickrust-analyzer cargo bottom 0.14.9 options/config/style/borders/WidgetBorderType#Thick# => BorderTyperust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#::Thickrust-analyzer cargo ratatui-widgets 0.3.2 borders/BorderType#Thick#, |
| 40 | } |
| 41 | } |
| 42 | } |