Skip to content

Commit

Permalink
feat(serde): Make serde optional
Browse files Browse the repository at this point in the history
Fixes #113
  • Loading branch information
epage committed May 25, 2017
1 parent 63883ca commit 839f44b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ appveyor = { repository = "cobalt-org/liquid-rust" }

[[bin]]
name = "liquid-dbg"
required-features = ["cli"]
required-features = ["cli", "serde"]
test = false
doctest = false
bench = false
doc = false

[[test]]
name = "liquid"
required-features = ["serde"]

[features]
default = ["extra-filters"]
cli = ["clap", "error-chain", "serde_yaml"]
Expand All @@ -37,9 +41,8 @@ chrono = "0.3"
unicode-segmentation = "1.1"
itertools = "0.6.0"
url = "1.4"
serde = "1.0"
serde_derive = "1.0"

serde = { version = "1.0", optional = true, features = ["derive"] }
clap = { version = "2.22.0", optional = true }
error-chain = { version = "0.10.0", optional = true }
serde_yaml = { version = "0.7", optional = true }
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ extern crate url;

#[macro_use]
extern crate lazy_static;

extern crate serde;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_derive;
extern crate serde;

use std::collections::HashMap;
use lexer::Element;
Expand Down
4 changes: 2 additions & 2 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use token::Token::*;

/// An enum to represent different value types
#[derive(Clone, Debug)]
#[derive(Serialize, Deserialize)]
#[serde(untagged)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
pub enum Value {
Num(f32),
Bool(bool),
Expand Down
1 change: 1 addition & 0 deletions tests/liquid.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 839f44b

Please sign in to comment.