summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-12-05 19:48:37 +0100
committerLaurenz <laurmaedje@gmail.com>2019-12-05 19:48:37 +0100
commit72a9631b038d1a60e4e4a78e92cd69e6f8ce4316 (patch)
tree17614efc2e21dd0b8caa24beaaaee7c40c150281 /src/syntax/span.rs
parentf72b1505bebf8d2fe1a60d386a3a3c3b67d4f903 (diff)
Move arg parser into `FuncArgs` and create (incomplete) consistent map 🧭
Diffstat (limited to 'src/syntax/span.rs')
-rw-r--r--src/syntax/span.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index aa494224..9e018437 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -5,27 +5,27 @@ use std::fmt::{self, Display, Formatter};
/// Annotates a value with the part of the source code it corresponds to.
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spanned<T> {
- pub val: T,
+ pub v: T,
pub span: Span,
}
impl<T> Spanned<T> {
- pub fn new(val: T, span: Span) -> Spanned<T> {
- Spanned { val, span }
+ pub fn new(v: T, span: Span) -> Spanned<T> {
+ Spanned { v, span }
}
pub fn value(self) -> T {
- self.val
+ self.v
}
- pub fn span_map<F, U>(self, f: F) -> Spanned<U> where F: FnOnce(T) -> U {
- Spanned::new(f(self.val), self.span)
+ pub fn map<F, U>(self, f: F) -> Spanned<U> where F: FnOnce(T) -> U {
+ Spanned::new(f(self.v), self.span)
}
}
impl<T> Display for Spanned<T> where T: std::fmt::Debug {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- write!(f, "({:?}:{})", self.val, self.span)
+ write!(f, "({:?}:{})", self.v, self.span)
}
}