summaryrefslogtreecommitdiff
path: root/src/library/basic.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-06-18 11:58:43 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-18 11:58:43 +0200
commit8b6391040e3fb2ab5f739e26f88621d63ad5d3cc (patch)
tree627527985c4dd6b89864ce10808a7be1d3e2c007 /src/library/basic.rs
parent6967c6c80a44186a9aa6ae695cf5caf61d3901fd (diff)
Remove eat_ prefix
Diffstat (limited to 'src/library/basic.rs')
-rw-r--r--src/library/basic.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/library/basic.rs b/src/library/basic.rs
index 333416b4..e0e464ae 100644
--- a/src/library/basic.rs
+++ b/src/library/basic.rs
@@ -11,7 +11,7 @@ use super::*;
/// # Return value
/// The name of the value's type as a string.
pub fn type_(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
- match args.eat_expect::<Value>(ctx, "value") {
+ match args.expect::<Value>(ctx, "value") {
Some(value) => value.type_name().into(),
None => Value::Error,
}
@@ -25,7 +25,7 @@ pub fn type_(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// # Return value
/// The string representation of the value.
pub fn repr(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
- match args.eat_expect::<Value>(ctx, "value") {
+ match args.expect::<Value>(ctx, "value") {
Some(value) => pretty(&value).into(),
None => Value::Error,
}
@@ -33,7 +33,7 @@ pub fn repr(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// `len`: The length of a string, an array or a dictionary.
pub fn len(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
- match args.eat_expect::<Spanned<Value>>(ctx, "collection") {
+ match args.expect::<Spanned<Value>>(ctx, "collection") {
Some(Spanned { v: Value::Str(v), .. }) => Value::Int(v.len() as i64),
Some(Spanned { v: Value::Array(v), .. }) => Value::Int(v.len() as i64),
Some(Spanned { v: Value::Dict(v), .. }) => Value::Int(v.len() as i64),
@@ -56,9 +56,9 @@ pub fn len(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// # Return value
/// The color with the given components.
pub fn rgb(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
- let r = args.eat_expect(ctx, "red component");
- let g = args.eat_expect(ctx, "green component");
- let b = args.eat_expect(ctx, "blue component");
+ let r = args.expect(ctx, "red component");
+ let g = args.expect(ctx, "green component");
+ let b = args.expect(ctx, "blue component");
let a = args.eat(ctx);
let mut clamp = |component: Option<Spanned<f64>>, default| {