Skip to content

Commit

Permalink
feat: put index serialization behind feature
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldelucia committed May 9, 2024
1 parent ddc9c0c commit 1185bc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ all_features = [
"identity-value-conversion",
"identity-json-conversion",
"identity-cbor-conversion",
"index-serde-conversion",
"state-transition-serde-conversion",
"state-transition-value-conversion",
"state-transition-json-conversion",
Expand Down Expand Up @@ -158,6 +159,7 @@ all_features_without_client = [
"identity-value-conversion",
"identity-json-conversion",
"identity-cbor-conversion",
"index-serde-conversion",
"state-transition-serde-conversion",
"state-transition-value-conversion",
"state-transition-json-conversion",
Expand Down Expand Up @@ -224,6 +226,7 @@ identity-cbor-conversion = [
"cbor",
"platform-value-cbor",
]
index-serde-conversion = []
state-transition-serde-conversion = ["data-contract-serde-conversion"]
state-transition-value-conversion = [
"platform-value",
Expand Down
6 changes: 4 additions & 2 deletions packages/rs-dpp/src/data_contract/document_type/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use std::{collections::BTreeMap, convert::TryFrom};
pub mod random_index;

// Indices documentation: https://dashplatform.readme.io/docs/reference-data-contracts#document-indices
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))]
pub struct Index {
pub name: String,
pub properties: Vec<IndexProperty>,
Expand Down Expand Up @@ -53,7 +54,8 @@ impl Index {
}
}

#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))]
pub struct IndexProperty {
pub name: String,
pub ascending: bool,
Expand Down

0 comments on commit 1185bc5

Please sign in to comment.