Level up exports.

This commit is contained in:
Stephen Chung
2021-11-16 12:26:37 +08:00
parent 98707912e0
commit 2fffe31b59
10 changed files with 43 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
//! Implement function-calling mechanism for [`Engine`].
use super::builtin::{get_builtin_binary_op_fn, get_builtin_op_assignment_fn};
use super::native::{CallableFunction, FnAny};
use super::{get_builtin_binary_op_fn, get_builtin_op_assignment_fn};
use crate::ast::FnCallHashes;
use crate::engine::{
EvalState, FnResolutionCacheEntry, Imports, KEYWORD_DEBUG, KEYWORD_EVAL, KEYWORD_FN_PTR,

View File

@@ -14,7 +14,7 @@ use std::{
///
/// Panics when hashing any data type other than a [`u64`].
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StraightHasher(u64);
struct StraightHasher(u64);
impl Hasher for StraightHasher {
#[inline(always)]
@@ -34,7 +34,7 @@ impl Hasher for StraightHasher {
/// A hash builder for `StraightHasher`.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
pub struct StraightHasherBuilder;
struct StraightHasherBuilder;
impl BuildHasher for StraightHasherBuilder {
type Hasher = StraightHasher;
@@ -135,6 +135,6 @@ pub fn calc_fn_params_hash(params: impl Iterator<Item = TypeId>) -> u64 {
/// Combine two [`u64`] hashes by taking the XOR of them.
#[inline(always)]
#[must_use]
pub(crate) const fn combine_hashes(a: u64, b: u64) -> u64 {
pub const fn combine_hashes(a: u64, b: u64) -> u64 {
a ^ b
}

View File

@@ -8,3 +8,18 @@ pub mod hashing;
pub mod native;
pub mod plugin;
pub mod register;
pub use args::FuncArgs;
pub use builtin::{get_builtin_binary_op_fn, get_builtin_op_assignment_fn};
pub use call::FnCallArgs;
pub use func::Func;
pub use hashing::{
calc_fn_hash, calc_fn_params_hash, calc_qualified_fn_hash, calc_qualified_var_hash,
combine_hashes, get_hasher,
};
pub use native::{
shared_make_mut, shared_take, shared_take_or_clone, shared_try_take, shared_write_lock,
CallableFunction, FnAny, FnPlugin, IteratorFn, Locked, NativeCallContext, SendSync, Shared,
};
pub use plugin::PluginFunction;
pub use register::RegisterNativeFunction;

View File

@@ -1,7 +1,7 @@
//! Module defining macros for developing _plugins_.
use super::call::FnCallArgs;
pub use super::native::CallableFunction;
pub use super::CallableFunction;
use super::FnCallArgs;
pub use crate::{
Dynamic, Engine, EvalAltResult, FnAccess, FnNamespace, ImmutableString, Module,
NativeCallContext, Position,
@@ -9,6 +9,7 @@ pub use crate::{
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
pub use std::{any::TypeId, mem};
pub type RhaiResult = Result<Dynamic, Box<EvalAltResult>>;
#[cfg(not(features = "no_module"))]