[−][src]Enum molt::types::ResultCode
Exceptional results of evaluating a Molt script.
A Molt script can return a normal result, as indicated by the Ok
MoltResult
, or it can return one of a number of exceptional results, which
will bubble up the call stack in the usual way until caught.
-
Error(Value)
: This code indicates a Molt error; theValue
is the error message for display to the user. -
Return(Value)
: This code indicates that a Molt procedure called thereturn
command. TheValue
is the returned value, or the empty value if no value was returned. This result will bubble up until it reaches the top-level of the procedure, which will then return the value as a normalOk
result. If it is received when evaluating an arbitrary script, i.e., ifreturn
is called outside of any procedure, the interpreter will convert it into a normalOk
result. -
Break
: This code indicates that the Moltbreak
command was called. It will break out of the inmost enclosing loop in the usual way. When returned outside a loop (or some user-defined control structure that supportsbreak
), the interpreter will convert it into an error. -
Continue
: This code indicates that the Moltcontinue
command was called. It will continue with the next iteration of the inmost enclosing loop in the usual way. When returned outside a loop (or some user-defined control structure that supportscontinue
), the interpreter will convert it into an error.
Client code will usually see only the Error
code; the others will most often be caught
and handled within the interpreter.
Future Work
-
Standard TCL includes more information with non-
Ok
results, especially for error cases. Ultimately, this type will be need to be extended to support that. -
Standard TCL allows for an arbitrary number of result codes, which in turn allows the application to define an arbitrary number of new kinds of control structures that are distinct from the standard ones. At some point we might wish to add one or more generic result codes, parallel to
Break
andContinue
, for this purpose.
Variants
Error(Value)
Return(Value)
Methods
impl ResultCode
[src]
Trait Implementations
impl Eq for ResultCode
[src]
impl Clone for ResultCode
[src]
fn clone(&self) -> ResultCode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<ResultCode> for ResultCode
[src]
fn eq(&self, other: &ResultCode) -> bool
[src]
fn ne(&self, other: &ResultCode) -> bool
[src]
impl Debug for ResultCode
[src]
Auto Trait Implementations
impl !Send for ResultCode
impl Unpin for ResultCode
impl !Sync for ResultCode
impl !RefUnwindSafe for ResultCode
impl !UnwindSafe for ResultCode
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,