Skip to content

Commit

Permalink
feat: serde support for style::Style
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev committed Sep 21, 2023
1 parent fca44df commit ee8756b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ runtime-c = ["syntastica-core/runtime-c", "syntastica-highlight/runtime-c"]
runtime-c2rust = ["syntastica-core/runtime-c2rust", "syntastica-highlight/runtime-c2rust"]

## Provide implementations of serde's `Serialize` and `Deserialize` traits for [`Theme`](theme::Theme)
## and [`Style`](style::Style)
serde = ["syntastica-core/serde"]

## Enable this when building the docs
Expand Down
8 changes: 5 additions & 3 deletions syntastica-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ runtime-c = ["dep:tree-sitter", "syntastica-highlight/runtime-c"]
## for more information.
runtime-c2rust = ["dep:tree-sitter-c2rust", "syntastica-highlight/runtime-c2rust"]

## Provide implementations of serde's `Serialize` and `Deserialize` traits for [`Theme`](theme::Theme)
## and [`Style`](style::Style)
serde = ["dep:serde", "palette/serializing"]

## Enable this when building the docs
docs = ["dep:document-features", "dep:rustc_version"]

Expand All @@ -34,11 +38,9 @@ tree-sitter-c2rust = { workspace = true, optional = true }

document-features = { workspace = true, optional = true }
palette = { version = "0.7.3", default-features = false, features = ["std"] }
serde = { workspace = true, features = ["derive"], optional = true }
tft = { workspace = true, features = ["detect"] }
thiserror.workspace = true

## Provide implementations of serde's `Serialize` and `Deserialize` traits for [`Theme`](theme::Theme)
serde = { workspace = true, features = ["derive"], optional = true }

[build-dependencies]
rustc_version = { workspace = true, optional = true }
1 change: 1 addition & 0 deletions syntastica-core/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub type Color = Srgb<u8>;
/// - Using the [`From<Color>`](#impl-From<Color>-for-Style) implementation to create a [`Style`]
/// with the given [`Color`] and all booleans disabled.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Style {
color: Color,
underline: bool,
Expand Down

0 comments on commit ee8756b

Please sign in to comment.