Skip to content

Commit 9fb8adb

Browse files
committed
Add more documentation
1 parent d8093ee commit 9fb8adb

File tree

1 file changed

+9
-11
lines changed
  • runtimes/rust/lbr-prelude-derive/src

1 file changed

+9
-11
lines changed

runtimes/rust/lbr-prelude-derive/src/lib.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
//! Automatically derive Json trait implementations
2-
//!
3-
//! Currently we only support a subset of types with an opinionated serialisation scheme. If you
4-
//! need anything else than what this library provides, it is advised to hand write the
5-
//! implementation.
6-
//!
7-
//! Supported types:
8-
//! - **unit structs (newtypes)**: this will simply remove the wrapper, and serialize the wrapped value
9-
//! - **structs**: serialized into a Json Object
10-
//! - **enums with unnamed fields**: serialized into an object with the following schema: `{"name": string, "fields": any[]}`
11-
121
use proc_macro::TokenStream;
132
use quote::{format_ident, quote};
143
use syn::{self, parse_macro_input, DeriveInput};
154

165
/// Derive a `Json` trait implementation
6+
///
7+
/// Currently we only support a subset of types with an opinionated serialisation scheme. If you
8+
/// need anything else than what this library provides, it is advised to hand write the
9+
/// implementation.
10+
///
11+
/// Supported types:
12+
/// - **unit structs (newtypes)**: this will simply remove the wrapper, and serialize the wrapped value
13+
/// - **structs**: serialized into a Json Object
14+
/// - **enums with unnamed fields**: serialized into an object with the following schema: `{"name": string, "fields": any[]}`
1715
#[proc_macro_derive(Json)]
1816
pub fn derive_json_fn(input: TokenStream) -> TokenStream {
1917
let ast = parse_macro_input!(input as DeriveInput);

0 commit comments

Comments
 (0)