mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-24 23:46:32 +01:00
convert more stdlib functions and add rounding
converted with_base and with_math
This commit is contained in:
@@ -40,25 +40,25 @@ impl Clone for Function {
|
||||
impl Function {
|
||||
pub fn new_static(
|
||||
out: Vec<(Type, Type)>,
|
||||
run: impl Fn(Data) -> Result<Data, CheckError> + Send + Sync + 'static,
|
||||
run: impl Fn(Data, &mut Info) -> Result<Data, CheckError> + Send + Sync + 'static,
|
||||
) -> Self {
|
||||
Self {
|
||||
info: crate::info::Info::neverused(),
|
||||
info_check: Arc::new(Mutex::new(crate::info::Info::neverused())),
|
||||
out: Err(Arc::new(out)),
|
||||
run: Arc::new(move |a, _| run(a)),
|
||||
run: Arc::new(run),
|
||||
inner_statements: None,
|
||||
}
|
||||
}
|
||||
pub fn new_generic(
|
||||
out: impl Fn(&Type) -> Result<Type, CheckError> + Send + Sync + 'static,
|
||||
run: impl Fn(Data) -> Result<Data, CheckError> + Send + Sync + 'static,
|
||||
run: impl Fn(Data, &mut Info) -> Result<Data, CheckError> + Send + Sync + 'static,
|
||||
) -> Self {
|
||||
Self {
|
||||
info: crate::info::Info::neverused(),
|
||||
info_check: Arc::new(Mutex::new(crate::info::Info::neverused())),
|
||||
out: Ok(Arc::new(move |a, _| out(a))),
|
||||
run: Arc::new(move |a, _| run(a)),
|
||||
run: Arc::new(run),
|
||||
inner_statements: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user