Skip to content

Commit

Permalink
serde-metadata: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tinybeachthor committed Oct 28, 2024
1 parent c98ea6d commit fd98a5a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion serde-metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ repository = { workspace = true }
homepage = { workspace = true }

[dependencies]
indexmap = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
serde = { workspace = true }
1 change: 1 addition & 0 deletions serde-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops::Deref;
use indexmap::IndexMap;
use serde::Serialize;

#[derive(Debug, Clone, PartialEq, Default, Serialize)]
pub struct Metadata {
items: IndexMap<String, String>,
}
Expand Down
30 changes: 30 additions & 0 deletions serde-metadata/tests/simple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use serde::Serialize;
use serde_metadata::{Metadata, SerdeMetadata};

#[derive(Serialize)]
pub struct Simple {
a: String,
b: u64,
}

#[derive(Serialize)]
pub struct SimpleMetadata {
a: Metadata,
b: Metadata,
}
impl Default for SimpleMetadata {
fn default() -> Self {
Self {
a: Default::default(),
b: Default::default(),
}
}
}

impl SerdeMetadata for Simple {
type METADATA = SimpleMetadata;
}

#[test]
fn get_metadata() {
}

0 comments on commit fd98a5a

Please sign in to comment.