pub struct UnknownPhaseToken(/* private fields */);Expand description
A phase token this build does not recognise, held so it cannot be confused with one it does.
§Why the payload is a type and not a bare String
WalletSyncPhase::Unrecognized serializes whatever it holds. With a public String inside,
Unrecognized("synced".to_owned()) was constructible by any consumer, reported
is_recognized() == false locally, went onto the wire as the bare token "synced", and arrived
at the far side as a confident WalletSyncPhase::Synced — a value that claims the wallet is
caught up while calling itself unrecognised. It was also the one value in the type that did not
round-trip, contradicting the verbatim-carriage guarantee the variant exists to provide.
The field is private and this type has no public constructor, so the only way to reach
Unrecognized from outside the crate is WalletSyncPhase::from, which is TOTAL: hand it a
known spelling and it returns that known variant instead. The dishonest value is therefore not
merely discouraged — it cannot be built.
This is deliberately a type-level guard rather than a documented rule. The whole family exists because a wire-level mismatch went unnoticed until someone built a probe, and a rule that only a doc comment enforces is the same shape of mistake one layer up.
Implementations§
Trait Implementations§
Source§impl Clone for UnknownPhaseToken
impl Clone for UnknownPhaseToken
Source§fn clone(&self) -> UnknownPhaseToken
fn clone(&self) -> UnknownPhaseToken
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more