summaryrefslogtreecommitdiff
path: root/src/model/args.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-30 15:13:28 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-30 16:45:41 +0100
commitf70cea508cd30fa40770ea989fe2a19e715a357b (patch)
tree731bb96b375dc8fd0f7e5a2a7e1d1fe5cb2a600e /src/model/args.rs
parentfe1f4400693690b68db5a7ec0976ba998624a740 (diff)
Remove index syntax in favor of accessor methods
Diffstat (limited to 'src/model/args.rs')
-rw-r--r--src/model/args.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/model/args.rs b/src/model/args.rs
index fe5f8254..4aaaded4 100644
--- a/src/model/args.rs
+++ b/src/model/args.rs
@@ -165,36 +165,6 @@ impl Args {
.filter_map(|item| item.name.clone().map(|name| (name, item.value.v.clone())))
.collect()
}
-
- /// Reinterpret these arguments as actually being an array index.
- pub fn into_index(self) -> SourceResult<i64> {
- self.into_castable("index")
- }
-
- /// Reinterpret these arguments as actually being a dictionary key.
- pub fn into_key(self) -> SourceResult<Str> {
- self.into_castable("key")
- }
-
- /// Reinterpret these arguments as actually being a single castable thing.
- fn into_castable<T: Cast>(self, what: &str) -> SourceResult<T> {
- let mut iter = self.items.into_iter();
- let value = match iter.next() {
- Some(Arg { name: None, value, .. }) => value.v.cast().at(value.span)?,
- None => {
- bail!(self.span, "missing {}", what);
- }
- Some(Arg { name: Some(_), span, .. }) => {
- bail!(span, "named pair is not allowed here");
- }
- };
-
- if let Some(arg) = iter.next() {
- bail!(arg.span, "only one {} is allowed", what);
- }
-
- Ok(value)
- }
}
impl Debug for Args {