Encapsulate FunctionsLib to hold script-defined functions.

This commit is contained in:
Stephen Chung
2020-03-26 20:26:05 +08:00
parent 8679982b4b
commit 56df5c49c8
6 changed files with 89 additions and 65 deletions

View File

@@ -236,7 +236,9 @@ impl EvalAltResult {
}
}
pub(crate) fn set_position(&mut self, new_position: Position) {
/// Consume the current `EvalAltResult` and return a new one
/// with the specified `Position`.
pub(crate) fn set_position(mut self, new_position: Position) -> Self {
match self {
#[cfg(not(feature = "no_std"))]
Self::ErrorReadingScriptFile(_, _) => (),
@@ -262,5 +264,7 @@ impl EvalAltResult {
| Self::ErrorLoopBreak(ref mut pos)
| Self::Return(_, ref mut pos) => *pos = new_position,
}
self
}
}