Enum knightrs::Value [−][src]
pub enum Value { Null, Boolean(Boolean), Number(Number), Text(Text), Variable(Variable), Function(Function, Rc<[Value]>), }
Variants
Boolean(Boolean)
Number(Number)
Text(Text)
Variable(Variable)
Implementations
impl Value
[src]
impl Value
[src]pub fn run(&self, env: &mut Environment<'_, '_, '_>) -> Result<Self, Error>
[src]
#[must_use = "getting the type name by itself does nothing."]pub const fn typename(&self) -> &'static str
[src]
#[must_use = "getting the type name by itself does nothing."]
pub const fn typename(&self) -> &'static strpub fn to_boolean(&self) -> Result<Boolean, Error>
[src]
pub fn to_number(&self) -> Result<Number, Error>
[src]
pub fn to_text(&self) -> Result<Text, Error>
[src]
impl Value
[src]
impl Value
[src]pub fn parse_str<S: AsRef<str>>(
input: S,
env: &mut Environment<'_, '_, '_>
) -> Result<Self, ParseError>
[src]
input: S,
env: &mut Environment<'_, '_, '_>
) -> Result<Self, ParseError>
Parses out a stream from the given input
within the context of env
.
This function simply calls [parse
] with a char iterator over input
; see it for more details.
Errors
This function returns any errors that [parse
] returns.
pub fn parse<S: IntoIterator<Item = char>>(
input: S,
env: &mut Environment<'_, '_, '_>
) -> Result<Self, ParseError>
[src]
input: S,
env: &mut Environment<'_, '_, '_>
) -> Result<Self, ParseError>
Parses out a stream from the given input
within the context of env
.
Note: Yes, technically this could be an iterator over u8
, as the Knight specs clearly state that all source
bytes are a subset of ASCII. However, we may want to support fun stuff like non-ASCII variables as an optional
extension in the future. As such, char
is required.
Errors
This function returns any errors that occur whilst parsing; See ParseError
’s variants for what conditions can
cause errors.
See Also
Section 1. within the Knight specs for parsing.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Value
impl !RefUnwindSafe for Value
impl !UnwindSafe for Value
impl !UnwindSafe for Value