Skip to main content

Module required

Module required 

Source
Expand description

A required Option field: the key must be on the wire, with null for none.

serde fills a missing Option field with None even without #[serde(default)], so a peer that leaves the key out is read as if it sent none. A field with its own deserialize_with does not get that, so #[serde(deserialize_with = "spoolframe_types::required::option")], which is only Option::deserialize, makes a missing key an error.

Functionsยง

option