Fix feature builds.
This commit is contained in:
parent
a9413dc570
commit
010a96dde3
@ -1,12 +1,14 @@
|
|||||||
//! Trait to build a custom type for use with [`Engine`].
|
//! Trait to build a custom type for use with [`Engine`].
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use crate::func::register::Mut;
|
|
||||||
use crate::{types::dynamic::Variant, Engine, Identifier, RegisterNativeFunction};
|
use crate::{types::dynamic::Variant, Engine, Identifier, RegisterNativeFunction};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
use std::prelude::v1::*;
|
use std::prelude::v1::*;
|
||||||
|
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
|
use crate::func::register::Mut;
|
||||||
|
|
||||||
/// Trait to build the API of a custom type for use with an [`Engine`]
|
/// Trait to build the API of a custom type for use with an [`Engine`]
|
||||||
/// (i.e. register the type and its getters, setters, methods, etc.).
|
/// (i.e. register the type and its getters, setters, methods, etc.).
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Module containing all deprecated API that will be removed in the next major version.
|
//! Module containing all deprecated API that will be removed in the next major version.
|
||||||
|
|
||||||
use crate::func::register::Mut;
|
use crate::func::RegisterNativeFunction;
|
||||||
use crate::func::{RegisterNativeFunction, SendSync};
|
|
||||||
use crate::types::dynamic::Variant;
|
use crate::types::dynamic::Variant;
|
||||||
use crate::{
|
use crate::{
|
||||||
Dynamic, Engine, EvalAltResult, FnPtr, Identifier, ImmutableString, NativeCallContext,
|
Dynamic, Engine, EvalAltResult, FnPtr, Identifier, ImmutableString, NativeCallContext,
|
||||||
@ -10,6 +9,9 @@ use crate::{
|
|||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
use std::prelude::v1::*;
|
use std::prelude::v1::*;
|
||||||
|
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
|
use crate::func::register::Mut;
|
||||||
|
|
||||||
#[cfg(not(feature = "no_std"))]
|
#[cfg(not(feature = "no_std"))]
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -165,7 +167,9 @@ impl Engine {
|
|||||||
pub fn register_get_result<T: Variant + Clone, V: Variant + Clone, S>(
|
pub fn register_get_result<T: Variant + Clone, V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
name: impl AsRef<str>,
|
name: impl AsRef<str>,
|
||||||
get_fn: impl RegisterNativeFunction<(Mut<T>,), V, RhaiResultOf<S>> + SendSync + 'static,
|
get_fn: impl RegisterNativeFunction<(Mut<T>,), V, RhaiResultOf<S>>
|
||||||
|
+ crate::func::SendSync
|
||||||
|
+ 'static,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.register_get(name, get_fn)
|
self.register_get(name, get_fn)
|
||||||
}
|
}
|
||||||
@ -184,7 +188,9 @@ impl Engine {
|
|||||||
pub fn register_set_result<T: Variant + Clone, V: Variant + Clone, S>(
|
pub fn register_set_result<T: Variant + Clone, V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
name: impl AsRef<str>,
|
name: impl AsRef<str>,
|
||||||
set_fn: impl RegisterNativeFunction<(Mut<T>, V), (), RhaiResultOf<S>> + SendSync + 'static,
|
set_fn: impl RegisterNativeFunction<(Mut<T>, V), (), RhaiResultOf<S>>
|
||||||
|
+ crate::func::SendSync
|
||||||
|
+ 'static,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.register_set(name, set_fn)
|
self.register_set(name, set_fn)
|
||||||
}
|
}
|
||||||
@ -215,7 +221,9 @@ impl Engine {
|
|||||||
S,
|
S,
|
||||||
>(
|
>(
|
||||||
&mut self,
|
&mut self,
|
||||||
get_fn: impl RegisterNativeFunction<(Mut<T>, X), V, RhaiResultOf<S>> + SendSync + 'static,
|
get_fn: impl RegisterNativeFunction<(Mut<T>, X), V, RhaiResultOf<S>>
|
||||||
|
+ crate::func::SendSync
|
||||||
|
+ 'static,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.register_indexer_get(get_fn)
|
self.register_indexer_get(get_fn)
|
||||||
}
|
}
|
||||||
@ -244,7 +252,9 @@ impl Engine {
|
|||||||
S,
|
S,
|
||||||
>(
|
>(
|
||||||
&mut self,
|
&mut self,
|
||||||
set_fn: impl RegisterNativeFunction<(Mut<T>, X, V), (), RhaiResultOf<S>> + SendSync + 'static,
|
set_fn: impl RegisterNativeFunction<(Mut<T>, X, V), (), RhaiResultOf<S>>
|
||||||
|
+ crate::func::SendSync
|
||||||
|
+ 'static,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.register_indexer_set(set_fn)
|
self.register_indexer_set(set_fn)
|
||||||
}
|
}
|
||||||
@ -424,6 +434,7 @@ impl<'a, T: Variant + Clone> crate::TypeBuilder<'a, T> {
|
|||||||
///
|
///
|
||||||
/// This method will be removed in the next major version.
|
/// This method will be removed in the next major version.
|
||||||
#[deprecated(since = "1.9.1", note = "use `with_get` instead")]
|
#[deprecated(since = "1.9.1", note = "use `with_get` instead")]
|
||||||
|
#[cfg(not(feature = "no_object"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn with_get_result<V: Variant + Clone, S>(
|
pub fn with_get_result<V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -445,6 +456,7 @@ impl<'a, T: Variant + Clone> crate::TypeBuilder<'a, T> {
|
|||||||
///
|
///
|
||||||
/// This method will be removed in the next major version.
|
/// This method will be removed in the next major version.
|
||||||
#[deprecated(since = "1.9.1", note = "use `with_set` instead")]
|
#[deprecated(since = "1.9.1", note = "use `with_set` instead")]
|
||||||
|
#[cfg(not(feature = "no_object"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn with_set_result<V: Variant + Clone, S>(
|
pub fn with_set_result<V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -468,6 +480,7 @@ impl<'a, T: Variant + Clone> crate::TypeBuilder<'a, T> {
|
|||||||
///
|
///
|
||||||
/// This method will be removed in the next major version.
|
/// This method will be removed in the next major version.
|
||||||
#[deprecated(since = "1.9.1", note = "use `with_indexer_get` instead")]
|
#[deprecated(since = "1.9.1", note = "use `with_indexer_get` instead")]
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn with_indexer_get_result<X: Variant + Clone, V: Variant + Clone, S>(
|
pub fn with_indexer_get_result<X: Variant + Clone, V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -488,6 +501,7 @@ impl<'a, T: Variant + Clone> crate::TypeBuilder<'a, T> {
|
|||||||
///
|
///
|
||||||
/// This method will be removed in the next major version.
|
/// This method will be removed in the next major version.
|
||||||
#[deprecated(since = "1.9.1", note = "use `with_indexer_set` instead")]
|
#[deprecated(since = "1.9.1", note = "use `with_indexer_set` instead")]
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn with_indexer_set_result<X: Variant + Clone, V: Variant + Clone, S>(
|
pub fn with_indexer_set_result<X: Variant + Clone, V: Variant + Clone, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
//! Module that defines the public function/module registration API of [`Engine`].
|
//! Module that defines the public function/module registration API of [`Engine`].
|
||||||
|
|
||||||
use crate::func::register::Mut;
|
|
||||||
use crate::func::{FnCallArgs, RegisterNativeFunction, SendSync};
|
use crate::func::{FnCallArgs, RegisterNativeFunction, SendSync};
|
||||||
use crate::types::dynamic::Variant;
|
use crate::types::dynamic::Variant;
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -10,6 +9,9 @@ use std::any::{type_name, TypeId};
|
|||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
use std::prelude::v1::*;
|
use std::prelude::v1::*;
|
||||||
|
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
|
use crate::func::register::Mut;
|
||||||
|
|
||||||
impl Engine {
|
impl Engine {
|
||||||
/// Get the global namespace module (which is the fist module in `global_modules`).
|
/// Get the global namespace module (which is the fist module in `global_modules`).
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Module defining external-loaded modules for Rhai.
|
//! Module defining external-loaded modules for Rhai.
|
||||||
|
|
||||||
use crate::ast::FnAccess;
|
use crate::ast::FnAccess;
|
||||||
use crate::func::register::Mut;
|
|
||||||
use crate::func::{
|
use crate::func::{
|
||||||
shared_take_or_clone, CallableFunction, FnCallArgs, IteratorFn, RegisterNativeFunction,
|
shared_take_or_clone, CallableFunction, FnCallArgs, IteratorFn, RegisterNativeFunction,
|
||||||
SendSync,
|
SendSync,
|
||||||
@ -21,6 +20,9 @@ use std::{
|
|||||||
ops::{Add, AddAssign},
|
ops::{Add, AddAssign},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
|
||||||
|
use crate::func::register::Mut;
|
||||||
|
|
||||||
/// A type representing the namespace of a function.
|
/// A type representing the namespace of a function.
|
||||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||||
#[cfg_attr(feature = "metadata", derive(serde::Serialize))]
|
#[cfg_attr(feature = "metadata", derive(serde::Serialize))]
|
||||||
|
Loading…
Reference in New Issue
Block a user