diff --git a/engine/src/lib.rs b/engine/src/lib.rs index d9109654..91addb40 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -115,7 +115,7 @@ pub use self::{ RegexFormat, }, scheme::{ - Field, FieldIndex, FieldRedefinitionError, Function, FunctionRedefinitionError, Identifier, + Field, FieldIndex, FieldRedefinitionError, Function, FunctionRedefinitionError, IdentifierRedefinitionError, IndexAccessError, List, Scheme, SchemeBuilder, SchemeMismatchError, UnknownFieldError, }, diff --git a/engine/src/scheme.rs b/engine/src/scheme.rs index 97975a49..32c97a88 100644 --- a/engine/src/scheme.rs +++ b/engine/src/scheme.rs @@ -226,31 +226,13 @@ impl<'s> Function<'s> { /// An enum to represent an entry inside a [`Scheme`](struct@Scheme). /// It can be either a [`Field`](struct@Field) or a [`Function`](struct@Function). #[derive(Debug)] -pub enum Identifier<'s> { +pub(crate) enum Identifier<'s> { /// Identifier is a [`Field`](struct@Field) Field(Field<'s>), /// Identifier is a [`Function`](struct@Function) Function(Function<'s>), } -impl<'s> Identifier<'s> { - /// Converts the identifier into a [`Field`](struct@Field) if possible. - pub fn into_field(self) -> Option> { - match self { - Self::Field(f) => Some(f), - _ => None, - } - } - - /// Converts the identifier into a [`Function`](struct@Function) if possible. - pub fn into_function(self) -> Option> { - match self { - Self::Function(f) => Some(f), - _ => None, - } - } -} - impl<'i, 's> LexWith<'i, &'s Scheme> for Identifier<'s> { fn lex_with(mut input: &'i str, scheme: &'s Scheme) -> LexResult<'i, Self> { let initial_input = input; @@ -522,7 +504,7 @@ impl<'de> Deserialize<'de> for Scheme { impl<'s> Scheme { /// Returns the [`identifier`](enum@Identifier) with the specified `name`. - pub fn get(&'s self, name: &str) -> Option> { + pub(crate) fn get(&'s self, name: &str) -> Option> { self.inner.items.get(name).map(move |item| match *item { SchemeItem::Field(index) => Identifier::Field(Field { scheme: self,