Add Dynamic::UNIT.
This commit is contained in:
@@ -54,7 +54,7 @@ macro_rules! gen_array_functions {
|
||||
list.resize(len as usize, Dynamic::from(item));
|
||||
}
|
||||
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
}
|
||||
})* }
|
||||
@@ -367,7 +367,7 @@ mod array_functions {
|
||||
list: &mut Array,
|
||||
reducer: FnPtr,
|
||||
) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
let mut result: Dynamic = ().into();
|
||||
let mut result: Dynamic = Dynamic::UNIT;
|
||||
|
||||
for (i, item) in list.iter().enumerate() {
|
||||
result = reducer
|
||||
@@ -434,7 +434,7 @@ mod array_functions {
|
||||
list: &mut Array,
|
||||
reducer: FnPtr,
|
||||
) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
let mut result: Dynamic = ().into();
|
||||
let mut result: Dynamic = Dynamic::UNIT;
|
||||
|
||||
for (i, item) in list.iter().enumerate().rev() {
|
||||
result = reducer
|
||||
@@ -529,7 +529,7 @@ mod array_functions {
|
||||
})
|
||||
});
|
||||
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn drain(
|
||||
|
@@ -284,7 +284,7 @@ mod string_functions {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
#[rhai_fn(name = "pad", return_raw)]
|
||||
pub fn pad_with_string(
|
||||
@@ -328,7 +328,7 @@ mod string_functions {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
|
@@ -150,7 +150,7 @@ mod time_functions {
|
||||
#[rhai_fn(return_raw, name = "+=")]
|
||||
pub fn add_assign(x: &mut Instant, seconds: FLOAT) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
*x = add_impl(*x, seconds)?;
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
#[rhai_fn(return_raw, name = "-")]
|
||||
pub fn subtract(x: Instant, seconds: FLOAT) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
@@ -162,7 +162,7 @@ mod time_functions {
|
||||
seconds: FLOAT,
|
||||
) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
*x = subtract_impl(*x, seconds)?;
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ mod time_functions {
|
||||
#[rhai_fn(return_raw, name = "+=")]
|
||||
pub fn add_assign(x: &mut Instant, seconds: INT) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
*x = add_impl(*x, seconds)?;
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
#[rhai_fn(return_raw, name = "-")]
|
||||
pub fn subtract(x: Instant, seconds: INT) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
@@ -213,7 +213,7 @@ mod time_functions {
|
||||
#[rhai_fn(return_raw, name = "-=")]
|
||||
pub fn subtract_assign(x: &mut Instant, seconds: INT) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
*x = subtract_impl(*x, seconds)?;
|
||||
Ok(().into())
|
||||
Ok(Dynamic::UNIT)
|
||||
}
|
||||
|
||||
#[rhai_fn(name = "==")]
|
||||
|
Reference in New Issue
Block a user