pub enum VariableValue {
String(String),
List(Vec<String>),
}Expand description
What a script variable can hold.
RSL has two kinds of variable: a plain string (set x = "…") and a list
(set xs = ["a", "b"], or the loop variable of a for).
Variants§
String(String)
A single string. Interpolation ({{ x }}) substitutes this directly.
List(Vec<String>)
An ordered list of strings, iterated by for and expanded by
list-valued interpolation.
Implementations§
Source§impl VariableValue
impl VariableValue
Sourcepub fn as_string(&self) -> Option<&str>
pub fn as_string(&self) -> Option<&str>
The string behind a VariableValue::String, or None for a list.
Call sites that interpolate a variable into a request use this to reject a list where a scalar is required.
Trait Implementations§
Source§impl Clone for VariableValue
impl Clone for VariableValue
Source§fn clone(&self) -> VariableValue
fn clone(&self) -> VariableValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariableValue
impl Debug for VariableValue
Source§impl PartialEq for VariableValue
impl PartialEq for VariableValue
impl StructuralPartialEq for VariableValue
Auto Trait Implementations§
impl Freeze for VariableValue
impl RefUnwindSafe for VariableValue
impl Send for VariableValue
impl Sync for VariableValue
impl Unpin for VariableValue
impl UnsafeUnpin for VariableValue
impl UnwindSafe for VariableValue
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