Skip to content

Figure out something better than an _extra struct member #20

Open
@iliana

Description

@iliana

tough::schema struct types have an _extra member:

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct RoleKeys {
pub keyids: Vec<Decoded<Hex>>,
pub threshold: NonZeroU64,
/// Extra arguments found during deserialization.
///
/// We must store these to correctly verify signatures for this object.
///
/// If you're instantiating this struct, you should make this `HashMap::empty()`.
#[serde(flatten)]
pub _extra: HashMap<String, Value>,
}

This is to handle keys that tough doesn't know about (yet), while still correctly validating signatures during serialization.

It'd be nice if consumers can create these structs without having to specify _extra: HashMap::new() or ..Default::default(). Not sure if there's any type magick we can perform.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions