Derives for high performance JSON serialisation and deserialisation.
```rust
struct MyStruct {
firstfield: String,
#[simdjson(rename = "foo")]
second_field: Option
fn main -> Result<(), simdjson::Error> { let mystruct = MyStruct { firstfield: "i am first".tostring(), secondfield: None } println!("Before: {mystruct:?}"); let mut jsonstring = mystruct.jsonstring()?; let deserialized = MyStruct::fromstr(jsonstring.asmut_str())?; println!("After: {deserialized:?}"); } ```
Attributres are supported for both #[simd_json(...)]
and for compatibilty also for #[serde(...)]
and follow the same naming conventions as serde.
For fields:
rename = "new_name"
- renames a fieldFor structs:
rename_all = "camelCase"
- renames all (not otherwise renamed) based on the rule, camelCase
is currently supporteddeny_unknown_fields
- Errors if unknown fields are encountered