Allow multiple packages in def_package.

This commit is contained in:
Stephen Chung 2021-12-22 12:41:55 +08:00
parent 1c50efbac8
commit 422db4269e
3 changed files with 4 additions and 4 deletions

View File

@ -15,8 +15,8 @@ New features
Enhancements
------------
* Added `NativeCallContext::call_fn` to easily call a function.
* A new syntax is introduced for `def_package!` that will replace the old syntax in future versions.
* Added `NativeCallContext::call_fn` to easily call a function.
* Doc-comments on plugin module functions are extracted into the functions' metadata.
Deprecated API's

View File

@ -4,7 +4,7 @@ use crate::{def_package, FnPtr, ImmutableString, NativeCallContext};
use std::prelude::v1::*;
def_package! {
/// Package of basic function poitner utilities.
/// Package of basic function pointer utilities.
crate::BasicFnPackage => |lib| {
lib.standard = true;

View File

@ -70,7 +70,7 @@ pub trait Package {
/// ```
#[macro_export]
macro_rules! def_package {
($(#[$outer:meta])* $root:ident :: $package:ident => | $lib:ident | $block:stmt) => {
($($(#[$outer:meta])* $root:ident :: $package:ident => | $lib:ident | $block:block)+) => { $(
$(#[$outer])*
pub struct $package($root::Shared<$root::Module>);
@ -97,7 +97,7 @@ macro_rules! def_package {
Self(module.into())
}
}
};
)* };
($root:ident : $package:ident : $comment:expr , $lib:ident , $block:stmt) => {
#[deprecated(since = "1.4.0", note = "this is an old syntax of `def_package!` and is deprecated; use the new syntax of `def_package!` instead")]
#[doc=$comment]