Deprecate Module::set_fn_XXX API.

This commit is contained in:
Stephen Chung
2021-03-15 12:39:06 +08:00
parent d0922adb5b
commit e9f280f917
9 changed files with 169 additions and 514 deletions

View File

@@ -141,7 +141,7 @@ macro_rules! reg_range {
($lib:ident | $x:expr => $( $y:ty ),*) => {
$(
$lib.set_iterator::<Range<$y>>();
let hash = $lib.set_fn_2($x, get_range::<$y>);
let hash = $lib.set_native_fn($x, get_range::<$y>);
$lib.update_fn_metadata(hash, &[
concat!("from: ", stringify!($y)),
concat!("to: ", stringify!($y)),
@@ -152,7 +152,7 @@ macro_rules! reg_range {
($lib:ident | step $x:expr => $( $y:ty ),*) => {
$(
$lib.set_iterator::<StepRange<$y>>();
let hash = $lib.set_fn_3($x, get_step_range::<$y>);
let hash = $lib.set_native_fn($x, get_step_range::<$y>);
$lib.update_fn_metadata(hash, &[
concat!("from: ", stringify!($y)),
concat!("to: ", stringify!($y)),
@@ -248,10 +248,10 @@ def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, {
lib.set_iterator::<StepDecimalRange>();
let hash = lib.set_fn_2("range", |from, to| StepDecimalRange::new(from, to, Decimal::one()));
let hash = lib.set_native_fn("range", |from, to| StepDecimalRange::new(from, to, Decimal::one()));
lib.update_fn_metadata(hash, &["from: Decimal", "to: Decimal", "Iterator<Item=Decimal>"]);
let hash = lib.set_fn_3("range", |from, to, step| StepDecimalRange::new(from, to, step));
let hash = lib.set_native_fn("range", |from, to, step| StepDecimalRange::new(from, to, step));
lib.update_fn_metadata(hash, &["from: Decimal", "to: Decimal", "step: Decimal", "Iterator<Item=Decimal>"]);
}
});