feat(host): add object publication and dispatch
This commit is contained in:
@@ -170,14 +170,8 @@ fn expand_interface(attribute: TokenStream2, item: ItemTrait) -> syn::Result<Tok
|
||||
}
|
||||
}
|
||||
|
||||
impl #definition_ident {
|
||||
/// Builds the interface descriptor generated from the trait declaration.
|
||||
pub fn descriptor() -> ::wip_interface::wip_protocol::InterfaceDescriptor {
|
||||
<Self as ::wip_interface::InterfaceDefinition>::descriptor()
|
||||
}
|
||||
|
||||
/// Dispatches one validated logical operation call to a typed implementation.
|
||||
pub fn dispatch<T: #trait_ident>(
|
||||
impl<T: #trait_ident> ::wip_interface::InterfaceImplementation<T> for #definition_ident {
|
||||
fn dispatch(
|
||||
implementation: &T,
|
||||
operation: &str,
|
||||
arguments: ::std::vec::Vec<::wip_interface::wip_protocol::NamedValue>,
|
||||
@@ -197,6 +191,29 @@ fn expand_interface(attribute: TokenStream2, item: ItemTrait) -> syn::Result<Tok
|
||||
}
|
||||
}
|
||||
|
||||
impl #definition_ident {
|
||||
/// Builds the interface descriptor generated from the trait declaration.
|
||||
pub fn descriptor() -> ::wip_interface::wip_protocol::InterfaceDescriptor {
|
||||
<Self as ::wip_interface::InterfaceDefinition>::descriptor()
|
||||
}
|
||||
|
||||
/// Dispatches one validated logical operation call to a typed implementation.
|
||||
pub fn dispatch<T: #trait_ident>(
|
||||
implementation: &T,
|
||||
operation: &str,
|
||||
arguments: ::std::vec::Vec<::wip_interface::wip_protocol::NamedValue>,
|
||||
) -> ::std::result::Result<
|
||||
::std::option::Option<::wip_interface::wip_protocol::Value>,
|
||||
::wip_interface::DispatchError,
|
||||
> {
|
||||
<Self as ::wip_interface::InterfaceImplementation<T>>::dispatch(
|
||||
implementation,
|
||||
operation,
|
||||
arguments,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#(#argument_items)*
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user