Streamline code.
This commit is contained in:
13
src/lib.rs
13
src/lib.rs
@@ -341,6 +341,9 @@ pub use eval::{Caches, FnResolutionCache, FnResolutionCacheEntry, GlobalRuntimeS
|
||||
#[cfg(feature = "metadata")]
|
||||
pub use api::definitions::Definitions;
|
||||
|
||||
/// Number of items to keep inline for [`StaticVec`].
|
||||
const STATIC_VEC_INLINE_SIZE: usize = 3;
|
||||
|
||||
/// Alias to [`smallvec::SmallVec<[T; 3]>`](https://crates.io/crates/smallvec), which is a
|
||||
/// specialized [`Vec`] backed by a small, inline, fixed-size array when there are ≤ 3 items stored.
|
||||
///
|
||||
@@ -373,7 +376,7 @@ pub use api::definitions::Definitions;
|
||||
/// most scripts load fewer than 4 external modules; most module paths contain fewer than 4 levels
|
||||
/// (e.g. `std::collections::map::HashMap` is 4 levels and it is just about as long as they get).
|
||||
#[cfg(not(feature = "internals"))]
|
||||
type StaticVec<T> = smallvec::SmallVec<[T; 3]>;
|
||||
type StaticVec<T> = smallvec::SmallVec<[T; STATIC_VEC_INLINE_SIZE]>;
|
||||
|
||||
/// _(internals)_ Alias to [`smallvec::SmallVec<[T; 3]>`](https://crates.io/crates/smallvec),
|
||||
/// which is a [`Vec`] backed by a small, inline, fixed-size array when there are ≤ 3 items stored.
|
||||
@@ -408,7 +411,11 @@ type StaticVec<T> = smallvec::SmallVec<[T; 3]>;
|
||||
/// most scripts load fewer than 4 external modules; most module paths contain fewer than 4 levels
|
||||
/// (e.g. `std::collections::map::HashMap` is 4 levels and it is just about as long as they get).
|
||||
#[cfg(feature = "internals")]
|
||||
pub type StaticVec<T> = smallvec::SmallVec<[T; 3]>;
|
||||
pub type StaticVec<T> = smallvec::SmallVec<[T; STATIC_VEC_INLINE_SIZE]>;
|
||||
|
||||
/// Number of items to keep inline for [`FnArgsVec`].
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
const FN_ARGS_VEC_INLINE_SIZE: usize = 5;
|
||||
|
||||
/// Inline arguments storage for function calls.
|
||||
///
|
||||
@@ -423,7 +430,7 @@ pub type StaticVec<T> = smallvec::SmallVec<[T; 3]>;
|
||||
///
|
||||
/// Under `no_closure`, this type aliases to [`StaticVec`][crate::StaticVec] instead.
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
type FnArgsVec<T> = smallvec::SmallVec<[T; 5]>;
|
||||
type FnArgsVec<T> = smallvec::SmallVec<[T; FN_ARGS_VEC_INLINE_SIZE]>;
|
||||
|
||||
/// Inline arguments storage for function calls.
|
||||
/// This type aliases to [`StaticVec`][crate::StaticVec].
|
||||
|
Reference in New Issue
Block a user