pub enum DiagParam {
Text(String),
Number {
value: i64,
decimals: u8,
},
Duration {
seconds: i64,
},
Keyed(MessagePart),
}Expand description
A value filled into a placeholder of a MessagePart.
Typed rather than pre-formatted, so the UI formats it in the operator’s
language: a number with the locale’s decimal separator, a duration as
“4 h 3 min” instead of “14595 s”. Fixed point instead of f64 keeps the
message comparable (Eq).
Variants§
Text(String)
Inserted verbatim (a name, a foreign error text).
Number
Fixed-point number value · 10^-decimals: 7179.5 is { value: 71795, decimals: 1 }.
Duration
A duration in whole seconds.
Keyed(MessagePart)
A translatable value: a key with its own parameters, filled into the placeholder as a sentence fragment in the operator’s language — e.g. a classified foreign error (“connection refused”) inside a message instead of the driver’s raw text. Nests arbitrarily.
Implementations§
Trait Implementations§
Source§impl From<MessagePart> for DiagParam
impl From<MessagePart> for DiagParam
Source§fn from(part: MessagePart) -> Self
fn from(part: MessagePart) -> Self
Converts to this type from the input type.
impl Eq for DiagParam
impl StructuralPartialEq for DiagParam
Auto Trait Implementations§
impl Freeze for DiagParam
impl RefUnwindSafe for DiagParam
impl Send for DiagParam
impl Sync for DiagParam
impl Unpin for DiagParam
impl UnwindSafe for DiagParam
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more