macro_rules! spi_dispatch_service {
(
/// Whether it is a managed request
/// 是否是管理模式
@mgr: $mgr: expr,
/// Backend service initialization method, called when the backend service instance is not initialized
///
/// 后端服务初始化方法,当后端服务实例未初始化时调用
@init: $init: expr,
/// Service object to dispatch to
///
/// 分发到的服务对象
@dispatch: $dispatch:tt,
/// Collection of request methods
///
/// 请求的方法集合
@method: {
$(
$(#[$attr:meta])*
$service:ident($($arg: ident: $type: ty),*) -> $ret:ty;
)*
}
) => { ... };
(@dispatch
$service:ident,
$funs:ident, $ctx:ident, $inst:ident,
@dispatch: {
$(
$(#[$attr:meta])*
$code:pat=>$mod:path,
)*
},
@args: $args: tt
) => { ... };
(@call
$mod:path, $fun:ident, $funs:ident, $ctx:ident, $inst:ident, @args: {$($args: ident),*}) => { ... };
}Expand description
SPI request dispatch macro
SPI请求分发宏
Used to generate request dispatch code in the SPI service
用于批量生成请求分发代码