summaryrefslogtreecommitdiff
path: root/dhall/src/core/var.rs
diff options
context:
space:
mode:
authorNadrieril2019-08-16 17:56:19 +0200
committerNadrieril2019-08-16 18:01:46 +0200
commit88ebc0f9d561a2541aad84a3152511a0439db8b4 (patch)
tree73571d5509f8631da63c09ec78acd30862f237f9 /dhall/src/core/var.rs
parente8bf879471708ac2cc03df904d14a618daaf2132 (diff)
Reduce api surface of dhall crate
Helps detect unused code
Diffstat (limited to 'dhall/src/core/var.rs')
-rw-r--r--dhall/src/core/var.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/dhall/src/core/var.rs b/dhall/src/core/var.rs
index d53c194..4ef1b93 100644
--- a/dhall/src/core/var.rs
+++ b/dhall/src/core/var.rs
@@ -16,7 +16,7 @@ pub struct AlphaVar {
#[derive(Clone, Eq)]
pub struct AlphaLabel(Label);
-pub trait Shift: Sized {
+pub(crate) trait Shift: Sized {
// Shift an expression to move it around binders without changing the meaning of its free
// variables. Shift by 1 to move an expression under a binder. Shift by -1 to extract an
// expression from under a binder, if the expression does not refer to that bound variable.
@@ -50,24 +50,24 @@ pub trait Shift: Sized {
}
}
-pub trait Subst<T> {
+pub(crate) trait Subst<T> {
fn subst_shift(&self, var: &AlphaVar, val: &T) -> Self;
}
impl AlphaVar {
- pub fn to_var(&self, alpha: bool) -> V<Label> {
+ pub(crate) fn to_var(&self, alpha: bool) -> V<Label> {
match (alpha, &self.alpha) {
(true, Some(x)) => V("_".into(), x.1),
_ => self.normal.clone(),
}
}
- pub fn from_var(normal: V<Label>) -> Self {
+ pub(crate) fn from_var(normal: V<Label>) -> Self {
AlphaVar {
normal,
alpha: None,
}
}
- pub fn from_var_and_alpha(normal: V<Label>, alpha: usize) -> Self {
+ pub(crate) fn from_var_and_alpha(normal: V<Label>, alpha: usize) -> Self {
AlphaVar {
normal,
alpha: Some(V((), alpha)),
@@ -76,14 +76,14 @@ impl AlphaVar {
}
impl AlphaLabel {
- pub fn to_label_maybe_alpha(&self, alpha: bool) -> Label {
+ pub(crate) fn to_label_maybe_alpha(&self, alpha: bool) -> Label {
if alpha {
"_".into()
} else {
self.to_label()
}
}
- pub fn to_label(&self) -> Label {
+ pub(crate) fn to_label(&self) -> Label {
self.clone().into()
}
}