pub enum Value {
String(String),
Number(i64),
List(Vec<String>),
Entity {
name: String,
features: AgreementFeatures,
},
}Expand description
A value that can be inserted into a rendering context.
The Value::Entity variant carries a named entity with optional
grammatical agreement features for multilingual rendering. In English
it renders identically to Value::String (just the name); non-English
grammars can inspect the features field for gender, number, case, etc.
Variants§
String(String)
Number(i64)
List(Vec<String>)
Entity
A named entity carrying agreement features for multilingual rendering.
In English rendering this behaves identically to Value::String(name).
Non-English grammars consult features to produce correctly-agreeing
articles, adjectives, pronouns, and verb forms.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_display(&self) -> String
pub fn as_display(&self) -> String
Render this value as a display string.
For Value::Entity this returns the entity’s name — identical
to the behaviour of Value::String.
Sourcepub fn as_list(&self) -> Option<&[String]>
pub fn as_list(&self) -> Option<&[String]>
Try to interpret this value as a list of strings.
Returns None for Value::Entity — entities are not lists.