#[non_exhaustive]pub enum Value {
Null,
String(String),
Integer(i64),
Float(f64),
Bool(bool),
List(Vec<Value>),
Map(BTreeMap<String, Value>),
}Expand description
A value from YAML frontmatter, preserving type information.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
String(String)
Integer(i64)
Float(f64)
Bool(bool)
List(Vec<Value>)
Map(BTreeMap<String, Value>)
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Try to interpret as i64 (from Integer, or by parsing a String).
Sourcepub fn list_contains(&self, needle: &str) -> bool
pub fn list_contains(&self, needle: &str) -> bool
Check if this value (as a List) contains an item matching the needle string.
Sourcepub fn display_value(&self) -> String
pub fn display_value(&self) -> String
Display-friendly string representation.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the inner bool if this is Value::Bool, else None.
Sourcepub fn as_list(&self) -> Option<&[Value]>
pub fn as_list(&self) -> Option<&[Value]>
Returns the inner list if this is Value::List, else None.
Sourcepub fn as_map(&self) -> Option<&BTreeMap<String, Value>>
pub fn as_map(&self) -> Option<&BTreeMap<String, Value>>
Returns the inner map if this is Value::Map, else None.
Sourcepub fn parse_scalar(s: &str) -> Self
pub fn parse_scalar(s: &str) -> Self
Best-effort parse of a CLI-style FIELD=VALUE scalar string into a
typed Value. Tries bool literal (true / false exact match —
case-sensitive to match YAML), then integer, then float, then falls
back to a string. Shared by every frontend that accepts
loosely-typed user input — CLI --set, MCP plan_update’s legacy
string-set path, and CreateBuilder set-field via the CLI.