feat(host): add object publication and dispatch
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
use wip_host::{InterfaceRegistry, PublishedObject, WipObject};
|
||||
use wip_interface::{OperationResult, interface};
|
||||
use wip_protocol::ObjectId;
|
||||
|
||||
#[interface]
|
||||
pub trait Search {
|
||||
fn search(&self) -> OperationResult<String>;
|
||||
}
|
||||
|
||||
struct Object;
|
||||
|
||||
impl WipObject for Object {
|
||||
fn id(&self) -> ObjectId {
|
||||
ObjectId("object".into())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut registry = InterfaceRegistry::new();
|
||||
let search = registry.register(SearchDefinition, None).unwrap();
|
||||
let _published = PublishedObject::new(Object).expose(&search).unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user