#[non_exhaustive]pub enum ContractViolation {
MissingMessage {
message: String,
},
MissingValue {
message: String,
},
MissingAttribute {
message: String,
attribute: String,
},
UnknownVariable {
message: String,
attribute: Option<String>,
variable: String,
},
ElementMismatch {
message: String,
expected: Vec<String>,
found: Vec<String>,
},
BoolSelectorMismatch {
message: String,
attribute: Option<String>,
variable: String,
found: Vec<String>,
},
BoolReferenceOutsideSelector {
message: String,
attribute: Option<String>,
variable: String,
},
UnknownTerm {
term: String,
referenced_from: String,
},
}Expand description
One way an external .ftl failed to satisfy a MessageContract.
Carried by L10nError::Validation. Each variant describes a mistake
that would otherwise surface later as a panic or formatting error in a
generated accessor.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingMessage
A contract message is missing from the .ftl entirely.
MissingValue
The message exists but has no value of its own, and the contract expects one (the message defines only attributes).
MissingAttribute
The message exists but lacks a required attribute.
UnknownVariable
The pattern references a variable that is not a contract argument. The generated accessor would leave it unfilled, which fails to format.
Fields
ElementMismatch
The (Element) marker sequence does not match the contract, so the
structured-message split would not produce the expected slots.
The entries are rendered as $variable / -term.
Fields
BoolSelectorMismatch
A Boolean variable’s selector does not contain exactly [true] and
[false] branches.
Fields
BoolReferenceOutsideSelector
A Boolean variable is referenced outside its selector, which would
render its encoded true / false string directly.
Fields
UnknownTerm
A referenced term is not defined in the .ftl. Resolving it would
fail to format at runtime.
Trait Implementations§
Source§impl Clone for ContractViolation
impl Clone for ContractViolation
Source§fn clone(&self) -> ContractViolation
fn clone(&self) -> ContractViolation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more