Fix formatting.
This commit is contained in:
parent
a07faf7dd9
commit
e7ca3f41dd
@ -91,10 +91,11 @@ impl Engine {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// All the arguments are _consumed_, meaning that they're replaced by `()`.
|
||||
/// This is to avoid unnecessarily cloning the arguments.
|
||||
///
|
||||
/// Do not use the arguments after this call. If they are needed afterwards,
|
||||
/// clone them _before_ calling this function.
|
||||
///
|
||||
@ -130,10 +131,10 @@ impl Engine {
|
||||
/// let result = engine.call_fn_raw(&mut scope, &ast, true, true, "bar", None, [])?;
|
||||
/// assert_eq!(result.cast::<i64>(), 21);
|
||||
///
|
||||
/// let mut value: Dynamic = 1_i64.into();
|
||||
/// let mut value = 1_i64.into();
|
||||
/// let result = engine.call_fn_raw(&mut scope, &ast, true, true, "action", Some(&mut value), [ 41_i64.into() ])?;
|
||||
/// // ^^^^^^^^^^^^^^^^ binding the 'this' pointer
|
||||
/// assert_eq!(value.as_int().expect("value should be INT"), 42);
|
||||
/// assert_eq!(value.as_int().unwrap(), 42);
|
||||
///
|
||||
/// engine.call_fn_raw(&mut scope, &ast, true, false, "decl", None, [ 42_i64.into() ])?;
|
||||
/// // ^^^^^ do not rewind scope
|
||||
|
@ -120,10 +120,11 @@ impl Engine {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// All the arguments are _consumed_, meaning that they're replaced by `()`.
|
||||
/// This is to avoid unnecessarily cloning the arguments.
|
||||
///
|
||||
/// Do not use the arguments after this call. If they are needed afterwards,
|
||||
/// clone them _before_ calling this function.
|
||||
///
|
||||
@ -220,7 +221,7 @@ impl NativeCallContext<'_> {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// All arguments may be _consumed_, meaning that they may be replaced by `()`. This is to avoid
|
||||
/// unnecessarily cloning the arguments.
|
||||
@ -276,10 +277,11 @@ impl FnPtr {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// All the arguments are _consumed_, meaning that they're replaced by `()`.
|
||||
/// This is to avoid unnecessarily cloning the arguments.
|
||||
///
|
||||
/// Do not use the arguments after this call. If they are needed afterwards,
|
||||
/// clone them _before_ calling this function.
|
||||
#[deprecated(
|
||||
|
@ -150,7 +150,7 @@ impl Engine {
|
||||
/// This function is very low level. It takes a list of [`TypeId`][std::any::TypeId]'s
|
||||
/// indicating the actual types of the parameters.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// Arguments are simply passed in as a mutable array of [`&mut Dynamic`][crate::Dynamic].
|
||||
/// The arguments are guaranteed to be of the correct types matching the [`TypeId`][std::any::TypeId]'s.
|
||||
|
@ -411,6 +411,5 @@ pub type OnVarCallback =
|
||||
Box<dyn Fn(&str, usize, &EvalContext) -> RhaiResultOf<Option<Dynamic>> + 'static>;
|
||||
/// A standard callback function for variable access.
|
||||
#[cfg(feature = "sync")]
|
||||
pub type OnVarCallback = Box<
|
||||
dyn Fn(&str, usize, &EvalContext) -> RhaiResultOf<Option<Dynamic>> + Send + Sync + 'static,
|
||||
>;
|
||||
pub type OnVarCallback =
|
||||
Box<dyn Fn(&str, usize, &EvalContext) -> RhaiResultOf<Option<Dynamic>> + Send + Sync + 'static>;
|
||||
|
@ -871,7 +871,7 @@ impl Module {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// A list of [`TypeId`]'s is taken as the argument types.
|
||||
///
|
||||
|
@ -305,11 +305,7 @@ pub mod array_functions {
|
||||
}
|
||||
|
||||
#[rhai_fn(return_raw, pure)]
|
||||
pub fn filter(
|
||||
ctx: NativeCallContext,
|
||||
array: &mut Array,
|
||||
filter: FnPtr,
|
||||
) -> RhaiResultOf<Array> {
|
||||
pub fn filter(ctx: NativeCallContext, array: &mut Array, filter: FnPtr) -> RhaiResultOf<Array> {
|
||||
if array.is_empty() {
|
||||
return Ok(array.clone());
|
||||
}
|
||||
@ -863,11 +859,7 @@ pub mod array_functions {
|
||||
Ok(())
|
||||
}
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn drain(
|
||||
ctx: NativeCallContext,
|
||||
array: &mut Array,
|
||||
filter: FnPtr,
|
||||
) -> RhaiResultOf<Array> {
|
||||
pub fn drain(ctx: NativeCallContext, array: &mut Array, filter: FnPtr) -> RhaiResultOf<Array> {
|
||||
if array.is_empty() {
|
||||
return Ok(Array::new());
|
||||
}
|
||||
@ -957,11 +949,7 @@ pub mod array_functions {
|
||||
array.drain(start..start + len).collect()
|
||||
}
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn retain(
|
||||
ctx: NativeCallContext,
|
||||
array: &mut Array,
|
||||
filter: FnPtr,
|
||||
) -> RhaiResultOf<Array> {
|
||||
pub fn retain(ctx: NativeCallContext, array: &mut Array, filter: FnPtr) -> RhaiResultOf<Array> {
|
||||
if array.is_empty() {
|
||||
return Ok(Array::new());
|
||||
}
|
||||
@ -1054,11 +1042,7 @@ pub mod array_functions {
|
||||
drained
|
||||
}
|
||||
#[rhai_fn(name = "==", return_raw, pure)]
|
||||
pub fn equals(
|
||||
ctx: NativeCallContext,
|
||||
array1: &mut Array,
|
||||
array2: Array,
|
||||
) -> RhaiResultOf<bool> {
|
||||
pub fn equals(ctx: NativeCallContext, array1: &mut Array, array2: Array) -> RhaiResultOf<bool> {
|
||||
if array1.len() != array2.len() {
|
||||
return Ok(false);
|
||||
}
|
||||
|
@ -110,12 +110,7 @@ pub mod blob_functions {
|
||||
}
|
||||
}
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn pad(
|
||||
ctx: NativeCallContext,
|
||||
blob: &mut Blob,
|
||||
len: INT,
|
||||
item: INT,
|
||||
) -> RhaiResultOf<()> {
|
||||
pub fn pad(ctx: NativeCallContext, blob: &mut Blob, len: INT, item: INT) -> RhaiResultOf<()> {
|
||||
if len <= 0 {
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Module containing error definitions for the evaluation process.
|
||||
|
||||
use crate::{Dynamic, ImmutableString, ParseErrorType, Position, INT, RhaiError};
|
||||
use crate::{Dynamic, ImmutableString, ParseErrorType, Position, RhaiError, INT};
|
||||
#[cfg(feature = "no_std")]
|
||||
use core_error::Error;
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
|
@ -204,10 +204,11 @@ impl FnPtr {
|
||||
///
|
||||
/// This function is very low level.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// # Arguments
|
||||
///
|
||||
/// All the arguments are _consumed_, meaning that they're replaced by `()`.
|
||||
/// This is to avoid unnecessarily cloning the arguments.
|
||||
///
|
||||
/// Do not use the arguments after this call. If they are needed afterwards,
|
||||
/// clone them _before_ calling this function.
|
||||
#[inline]
|
||||
|
Loading…
Reference in New Issue
Block a user