#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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 integer, then float, then falls back to a
string. Shared by every frontend that accepts loosely-typed user
input — CLI --set, MCP plan_update, the upcoming
CreateBuilder set-field path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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