diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-18 01:07:50 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-18 01:07:50 +0100 |
| commit | 05ec0f993b4a1b8481e494ee16285d23f000872f (patch) | |
| tree | bad1ea092025213173e66a3a88cf2c8d3f4ca3a3 /src/eval/func.rs | |
| parent | acae6e2a54f11b27bae343a15d9eff952323fe28 (diff) | |
Headers and footers
Diffstat (limited to 'src/eval/func.rs')
| -rw-r--r-- | src/eval/func.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/eval/func.rs b/src/eval/func.rs index 9a8a9c94..128509f8 100644 --- a/src/eval/func.rs +++ b/src/eval/func.rs @@ -167,6 +167,21 @@ pub struct Arg { } impl Args { + /// Create positional arguments from a span and values. + pub fn from_values(span: Span, values: impl IntoIterator<Item = Value>) -> Self { + Self { + span, + items: values + .into_iter() + .map(|value| Arg { + span, + name: None, + value: Spanned::new(value, span), + }) + .collect(), + } + } + /// Consume and cast the first positional argument. /// /// Returns a `missing argument: {what}` error if no positional argument is |
