Function opentitanlib::util::serde::string_or_struct
source · pub fn string_or_struct<'de, T, D>(deserializer: D) -> Result<T, D::Error>where
T: Deserialize<'de> + FromStr,
<T as FromStr>::Err: Error,
D: Deserializer<'de>,
Expand description
Deserialize a type T from either a string or struct by forwarding
string forms to FromStr
.
The use-case for this is to allow specifying key material in ownership configuration files either directly or by filename:
key: {
Ecdsa: "some/path/to/key.pub.der"
}
key: {
Ecdsa: {
x: "...",
y: "..."
}
}