Update code example in readme
This commit is contained in:
parent
317c317e95
commit
b40c160ec2
1 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ Work in progress!
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use schemars::{JsonSchema, schema_for};
|
use schemars::{schema_for, JsonSchema};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, JsonSchema)]
|
#[derive(Deserialize, Serialize, JsonSchema)]
|
||||||
|
@ -28,7 +28,7 @@ struct Nested {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let schema = schema_for!(MyStruct)?;
|
let schema = schema_for!(MyStruct);
|
||||||
println!("{}", serde_json::to_string_pretty(&schema)?);
|
println!("{}", serde_json::to_string_pretty(&schema)?);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue