-
Notifications
You must be signed in to change notification settings - Fork 61
GSB Service
Przemysław Rekucki edited this page Feb 7, 2020
·
2 revisions
Proposition
#[gsb("/local/my-service")]
trait MyService {
async fn create(&self, create : Create) -> Result<(), Error>;
async fn update(&self, update : Update) -> Result<bool, Error>;
}
Generates
impl RpcMessage for Create {
const ID :&str = "create";
type Item = ();
type Error = Error;
}
impl RpcMessage for Update {
const ID :&str = "update";
type Item = bool;
type Error = Error;
}
pub struct MyService {
...
}
impl MyService {
pub const ID = "/local/my-service";
pub async fn create(&self, create : Create) -> Result<(), Error> {...}
pub async fn update(&self, update : Update) -> Result<bool, Error> {...}
pub fn new() -> Self;
}
#[gsb]
impl MyService for Service {
async fn create(&self, create : Create) -> Result<(), Error> {...}
fn update(&self, update : Update) -> ActorFuture<Self, bool, Error> { ... }
}