Add generic type to remote derive example
This commit is contained in:
parent
be92d4da5f
commit
e25791dddf
4 changed files with 20 additions and 0 deletions
|
@ -31,6 +31,9 @@ pub struct Process {
|
||||||
pub command_line: String,
|
pub command_line: String,
|
||||||
#[serde(with = "DurationDef")]
|
#[serde(with = "DurationDef")]
|
||||||
pub wall_time: Duration,
|
pub wall_time: Duration,
|
||||||
|
// Generic types must be explicitly specified with turbofix `::<>` syntax.
|
||||||
|
#[serde(with = "Vec::<DurationDef>")]
|
||||||
|
pub durations: Vec<Duration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,12 +4,19 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"command_line",
|
"command_line",
|
||||||
|
"durations",
|
||||||
"wall_time"
|
"wall_time"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"command_line": {
|
"command_line": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"durations": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/Duration"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wall_time": {
|
"wall_time": {
|
||||||
"$ref": "#/definitions/Duration"
|
"$ref": "#/definitions/Duration"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ pub struct Process {
|
||||||
pub command_line: String,
|
pub command_line: String,
|
||||||
#[serde(with = "DurationDef")]
|
#[serde(with = "DurationDef")]
|
||||||
pub wall_time: Duration,
|
pub wall_time: Duration,
|
||||||
|
// Generic types must be explicitly specified with turbofix `::<>` syntax.
|
||||||
|
#[serde(with = "Vec::<DurationDef>")]
|
||||||
|
pub durations: Vec<Duration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,12 +4,19 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"command_line",
|
"command_line",
|
||||||
|
"durations",
|
||||||
"wall_time"
|
"wall_time"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"command_line": {
|
"command_line": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"durations": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/Duration"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wall_time": {
|
"wall_time": {
|
||||||
"$ref": "#/definitions/Duration"
|
"$ref": "#/definitions/Duration"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue