Fix builds.

This commit is contained in:
Stephen Chung
2022-08-18 21:16:42 +08:00
parent 83589be58e
commit a9b6e8b98c
12 changed files with 80 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
//! Global runtime state.
use crate::{Dynamic, Engine, Identifier, ImmutableString};
use crate::{Dynamic, Engine, Identifier};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
use std::{fmt, marker::PhantomData};
@@ -9,7 +9,7 @@ use std::{fmt, marker::PhantomData};
#[cfg(not(feature = "no_module"))]
#[cfg(not(feature = "no_function"))]
pub type GlobalConstants =
crate::Shared<crate::Locked<std::collections::BTreeMap<ImmutableString, Dynamic>>>;
crate::Shared<crate::Locked<std::collections::BTreeMap<crate::ImmutableString, Dynamic>>>;
/// _(internals)_ Global runtime states.
/// Exported under the `internals` feature only.
@@ -25,7 +25,7 @@ pub type GlobalConstants =
pub struct GlobalRuntimeState<'a> {
/// Stack of module names.
#[cfg(not(feature = "no_module"))]
keys: crate::StaticVec<ImmutableString>,
keys: crate::StaticVec<crate::ImmutableString>,
/// Stack of imported [modules][crate::Module].
#[cfg(not(feature = "no_module"))]
modules: crate::StaticVec<crate::Shared<crate::Module>>,
@@ -169,7 +169,7 @@ impl GlobalRuntimeState<'_> {
#[inline(always)]
pub fn push_import(
&mut self,
name: impl Into<ImmutableString>,
name: impl Into<crate::ImmutableString>,
module: impl Into<crate::Shared<crate::Module>>,
) {
self.keys.push(name.into());
@@ -205,7 +205,7 @@ impl GlobalRuntimeState<'_> {
#[inline]
pub(crate) fn iter_imports_raw(
&self,
) -> impl Iterator<Item = (&ImmutableString, &crate::Shared<crate::Module>)> {
) -> impl Iterator<Item = (&crate::ImmutableString, &crate::Shared<crate::Module>)> {
self.keys.iter().rev().zip(self.modules.iter().rev())
}
/// Get an iterator to the stack of globally-imported [modules][crate::Module] in forward order.
@@ -216,7 +216,7 @@ impl GlobalRuntimeState<'_> {
#[inline]
pub fn scan_imports_raw(
&self,
) -> impl Iterator<Item = (&ImmutableString, &crate::Shared<crate::Module>)> {
) -> impl Iterator<Item = (&crate::ImmutableString, &crate::Shared<crate::Module>)> {
self.keys.iter().zip(self.modules.iter())
}
/// Does the specified function hash key exist in the stack of globally-imported
@@ -310,9 +310,9 @@ impl GlobalRuntimeState<'_> {
#[cfg(not(feature = "no_module"))]
impl IntoIterator for GlobalRuntimeState<'_> {
type Item = (ImmutableString, crate::Shared<crate::Module>);
type Item = (crate::ImmutableString, crate::Shared<crate::Module>);
type IntoIter = std::iter::Zip<
std::iter::Rev<smallvec::IntoIter<[ImmutableString; 3]>>,
std::iter::Rev<smallvec::IntoIter<[crate::ImmutableString; 3]>>,
std::iter::Rev<smallvec::IntoIter<[crate::Shared<crate::Module>; 3]>>,
>;
@@ -327,9 +327,9 @@ impl IntoIterator for GlobalRuntimeState<'_> {
#[cfg(not(feature = "no_module"))]
impl<'a> IntoIterator for &'a GlobalRuntimeState<'_> {
type Item = (&'a ImmutableString, &'a crate::Shared<crate::Module>);
type Item = (&'a crate::ImmutableString, &'a crate::Shared<crate::Module>);
type IntoIter = std::iter::Zip<
std::iter::Rev<std::slice::Iter<'a, ImmutableString>>,
std::iter::Rev<std::slice::Iter<'a, crate::ImmutableString>>,
std::iter::Rev<std::slice::Iter<'a, crate::Shared<crate::Module>>>,
>;
@@ -341,7 +341,7 @@ impl<'a> IntoIterator for &'a GlobalRuntimeState<'_> {
}
#[cfg(not(feature = "no_module"))]
impl<K: Into<ImmutableString>, M: Into<crate::Shared<crate::Module>>> Extend<(K, M)>
impl<K: Into<crate::ImmutableString>, M: Into<crate::Shared<crate::Module>>> Extend<(K, M)>
for GlobalRuntimeState<'_>
{
#[inline]