feat(core): add Arguments::positional, returns an iterator over positional parameters

This commit is contained in:
Ryan Leckey 2021-02-18 14:11:47 -08:00
parent 46f314103a
commit 367633a00a
No known key found for this signature in database
GPG Key ID: F8AA68C235AB08C9

View File

@ -108,6 +108,11 @@ impl<'a, Db: Database> Arguments<'a, Db> {
self.positional.len()
}
/// Returns an iterator of the positional parameters.
pub fn positional(&self) -> impl Iterator<Item = &Argument<'a, Db>> {
self.positional.iter()
}
/// Returns a reference to the argument at the location, if present.
pub fn get<'x, I: ArgumentIndex<'a, Db>>(&'x self, index: &I) -> Option<&'x Argument<'a, Db>> {
index.get(self)