Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions engine/src/lhs_types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ impl<'a> Array<'a> {
}
}

/// Creates a new array with the specified capacity
pub fn with_capacity(val_type: impl Into<CompoundType>, capacity: usize) -> Self {
Self {
val_type: val_type.into(),
data: InnerArray::Owned(Vec::with_capacity(capacity)),
}
}

/// Get a reference to an element if it exists
pub fn get(&self, idx: usize) -> Option<&LhsValue<'a>> {
self.data.get(idx)
Expand Down
9 changes: 6 additions & 3 deletions engine/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,10 @@ impl<'a> LhsValue<'a> {
/// nested element.
///
/// Both LhsValue::Array and LhsValue::Map support nested elements.
pub fn get(&'a self, item: &FieldIndex) -> Result<Option<&'a LhsValue<'a>>, IndexAccessError> {
pub(crate) fn get(
&'a self,
item: &FieldIndex,
) -> Result<Option<&'a LhsValue<'a>>, IndexAccessError> {
match (self, item) {
(LhsValue::Array(arr), FieldIndex::ArrayIndex(idx)) => Ok(arr.get(*idx as usize)),
(_, FieldIndex::ArrayIndex(_)) => Err(IndexAccessError {
Expand Down Expand Up @@ -853,7 +856,7 @@ impl<'a> LhsValue<'a> {
}

/// Returns an iterator over the Map or Array
pub fn iter(&'a self) -> Option<Iter<'a>> {
pub(crate) fn iter(&'a self) -> Option<Iter<'a>> {
match self {
LhsValue::Array(array) => Some(Iter::IterArray(array.as_slice().iter())),
LhsValue::Map(map) => Some(Iter::IterMap(map.iter())),
Expand Down Expand Up @@ -955,7 +958,7 @@ impl<'a> IntoIterator for LhsValue<'a> {
}
}

pub enum Iter<'a> {
pub(crate) enum Iter<'a> {
IterArray(std::slice::Iter<'a, LhsValue<'a>>),
IterMap(MapIter<'a, 'a>),
}
Expand Down
Loading