fedimint_core

Macro extensible_associated_module_type

Source
macro_rules! extensible_associated_module_type {
    ($name:ident, $name_v0:ident, $error:ident) => { ... };
}
Expand description

Macro for defining module associated types.

Wraps a type into an enum with a default variant, this allows to add new versions of the type in the future. Depending on context unknown versions may be ignored or lead to errors. E.g. the client might just ignore an unknown input version since it cannot originate from itself while the server would reject it for not being able to validate its correctness.

Adding extensibility this way is a last line of defense against breaking changes, most often other ways of introducing new functionality should be preferred (e.g. new module versions, pure client-side changes, …).