Deprecate FnPtr::num_curried.
This commit is contained in:
parent
b23d64bec0
commit
fc64e93b93
@ -9,6 +9,11 @@ Bug fixes
|
|||||||
|
|
||||||
* Self-contained `AST` now works properly with `Engine::call_fn`.
|
* Self-contained `AST` now works properly with `Engine::call_fn`.
|
||||||
|
|
||||||
|
Deprecated API's
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* `FnPtr::num_curried` is deprecated in favor of `FnPtr::curry().len()`.
|
||||||
|
|
||||||
|
|
||||||
Version 1.7.0
|
Version 1.7.0
|
||||||
=============
|
=============
|
||||||
|
@ -259,6 +259,19 @@ impl<T> From<EvalAltResult> for RhaiResultOf<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FnPtr {
|
impl FnPtr {
|
||||||
|
/// Get the number of curried arguments.
|
||||||
|
///
|
||||||
|
/// # Deprecated
|
||||||
|
///
|
||||||
|
/// This method is deprecated. Use [`curry().len()`][`FnPtr::curry`] instead.
|
||||||
|
///
|
||||||
|
/// This method will be removed in the next major version.
|
||||||
|
#[deprecated(since = "1.8.0", note = "use `curry().len()` instead")]
|
||||||
|
#[inline(always)]
|
||||||
|
#[must_use]
|
||||||
|
pub fn num_curried(&self) -> usize {
|
||||||
|
self.curry().len()
|
||||||
|
}
|
||||||
/// Call the function pointer with curried arguments (if any).
|
/// Call the function pointer with curried arguments (if any).
|
||||||
/// The function may be script-defined (not available under `no_function`) or native Rust.
|
/// The function may be script-defined (not available under `no_function`) or native Rust.
|
||||||
///
|
///
|
||||||
|
@ -88,12 +88,6 @@ impl FnPtr {
|
|||||||
pub fn is_curried(&self) -> bool {
|
pub fn is_curried(&self) -> bool {
|
||||||
!self.1.is_empty()
|
!self.1.is_empty()
|
||||||
}
|
}
|
||||||
/// Get the number of curried arguments.
|
|
||||||
#[inline(always)]
|
|
||||||
#[must_use]
|
|
||||||
pub fn num_curried(&self) -> usize {
|
|
||||||
self.1.len()
|
|
||||||
}
|
|
||||||
/// Does the function pointer refer to an anonymous function?
|
/// Does the function pointer refer to an anonymous function?
|
||||||
///
|
///
|
||||||
/// Not available under `no_function`.
|
/// Not available under `no_function`.
|
||||||
@ -219,8 +213,8 @@ impl FnPtr {
|
|||||||
let mut arg_values = arg_values.as_mut();
|
let mut arg_values = arg_values.as_mut();
|
||||||
let mut args_data;
|
let mut args_data;
|
||||||
|
|
||||||
if self.num_curried() > 0 {
|
if self.is_curried() {
|
||||||
args_data = StaticVec::with_capacity(self.num_curried() + arg_values.len());
|
args_data = StaticVec::with_capacity(self.curry().len() + arg_values.len());
|
||||||
args_data.extend(self.curry().iter().cloned());
|
args_data.extend(self.curry().iter().cloned());
|
||||||
args_data.extend(arg_values.iter_mut().map(mem::take));
|
args_data.extend(arg_values.iter_mut().map(mem::take));
|
||||||
arg_values = args_data.as_mut();
|
arg_values = args_data.as_mut();
|
||||||
|
Loading…
Reference in New Issue
Block a user