added list len, front, and back

This commit is contained in:
Ava Hahn 2023-03-07 14:29:31 -08:00
parent 06d30ac263
commit 7fd47c1812
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
5 changed files with 215 additions and 12 deletions

View file

@ -145,14 +145,15 @@ impl Args {
} else {
return Err("expected no args".to_string());
}
}
},
Args::Infinite => {
if !args.is_empty() {
return Ok(());
} else {
return Err("expected args but none were provided".to_string());
}
}
},
Args::Lazy(ref num) => {
let called_arg_count = args.len();
@ -167,7 +168,7 @@ impl Args {
} else if let Ctr::None = *args.car {
return Err(format!("expected {} args. Got 0.", num,));
}
}
},
Args::Strict(ref arg_types) => {
let mut idx: usize = 0;
@ -202,7 +203,7 @@ impl Args {
return Err("too few arguments".to_string());
}
}
}
},
}
Ok(())