diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-18 11:58:43 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-18 11:58:43 +0200 |
| commit | 8b6391040e3fb2ab5f739e26f88621d63ad5d3cc (patch) | |
| tree | 627527985c4dd6b89864ce10808a7be1d3e2c007 /src/eval | |
| parent | 6967c6c80a44186a9aa6ae695cf5caf61d3901fd (diff) | |
Remove eat_ prefix
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/mod.rs | 3 | ||||
| -rw-r--r-- | src/eval/value.rs | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 4b5feb0d..67f710c3 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -537,8 +537,7 @@ impl Eval for ClosureExpr { for param in params.iter() { // Set the parameter to `none` if the argument is missing. - let value = - args.eat_expect::<Value>(ctx, param.as_str()).unwrap_or_default(); + let value = args.expect::<Value>(ctx, param.as_str()).unwrap_or_default(); ctx.scopes.def_mut(param.as_str(), value); } diff --git a/src/eval/value.rs b/src/eval/value.rs index 51e45190..f2bc4fd6 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -308,7 +308,7 @@ impl FuncArgs { /// Find and consume the first castable positional argument, producing a /// `missing argument: {what}` error if no match was found. - pub fn eat_expect<T>(&mut self, ctx: &mut EvalContext, what: &str) -> Option<T> + pub fn expect<T>(&mut self, ctx: &mut EvalContext, what: &str) -> Option<T> where T: Cast<Spanned<Value>>, { @@ -325,7 +325,7 @@ impl FuncArgs { /// iterator would require unique access to the context, rendering it rather /// unusable. If you need to process arguments one-by-one, you probably want /// to use a while-let loop together with [`eat()`](Self::eat). - pub fn eat_all<T>(&mut self, ctx: &mut EvalContext) -> Vec<T> + pub fn all<T>(&mut self, ctx: &mut EvalContext) -> Vec<T> where T: Cast<Spanned<Value>>, { @@ -334,7 +334,7 @@ impl FuncArgs { /// Cast and remove the value for the given named argument, producing an /// error if the conversion fails. - pub fn eat_named<T>(&mut self, ctx: &mut EvalContext, name: &str) -> Option<T> + pub fn named<T>(&mut self, ctx: &mut EvalContext, name: &str) -> Option<T> where T: Cast<Spanned<Value>>, { |
