pub enum Value {
None,
Bool(bool),
Int(i64),
Float(f64),
Str(Rc<str>),
List(Rc<RefCell<Vec<Value>>>),
Map(Rc<RefCell<MapData>>),
Func(Rc<Function>),
Builtin(&'static str),
}Expand description
A TextWrite runtime value.
Variants§
None
Bool(bool)
Int(i64)
Float(f64)
Str(Rc<str>)
List(Rc<RefCell<Vec<Value>>>)
Map(Rc<RefCell<MapData>>)
Func(Rc<Function>)
Builtin(&'static str)
Implementations§
Source§impl Value
impl Value
pub fn str(s: impl Into<String>) -> Value
pub fn list(items: Vec<Value>) -> Value
pub fn map(entries: MapData) -> Value
pub fn type_name(&self) -> &'static str
pub fn is_truthy(&self) -> bool
Sourcepub fn deep_eq(&self, other: &Value) -> bool
pub fn deep_eq(&self, other: &Value) -> bool
Structural equality, backing the is / == operators.
pub fn as_f64(&self) -> Option<f64>
pub fn as_i64(&self) -> Option<i64>
pub fn as_str(&self) -> Option<&str>
Sourcepub fn repr(&self) -> String
pub fn repr(&self) -> String
A debug-style rendering, quoting strings (used inside lists and maps).
Sourcepub fn to_display(&self) -> String
pub fn to_display(&self) -> String
Rendering used by print and string interpolation: strings unquoted.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl !UnwindSafe for Value
impl Forget for Value
impl Freeze for Value
impl Move for Value
impl Unpin for Value
impl UnsafeUnpin 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