Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

feat(binding-macro): service method supports none payload and none response #103

Merged
merged 7 commits into from
Jan 9, 2020
Merged

feat(binding-macro): service method supports none payload and none response #103

merged 7 commits into from
Jan 9, 2020

Conversation

nolanxyg
Copy link
Contributor

@nolanxyg nolanxyg commented Jan 8, 2020

What type of PR is this?

feature: binding-macro

What this PR does / why we need it:

Add feature: service method supports none payload and none response

#[read] 
fn read_method(&self, ctx: ServiceContext) -> ProtocolResult<()>;

#[write] 
fn write_method(&self, ctx: ServiceContext) -> ProtocolResult<()>;

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

If service method return (), the value return from ServiceSDK, would be Ok("")

pub trait ServiceSDK {
    fn read(
        &self,
        ctx: &ServiceContext,
        service: &str,
        method: &str,
        payload: &str,
    ) -> ProtocolResult<String>;

    fn write(
        &mut self,
        ctx: &ServiceContext,
        service: &str,
        method: &str,
        payload: &str,
    ) -> ProtocolResult<String>;

@nolanxyg nolanxyg requested a review from a team January 8, 2020 09:40
binding-macro/src/lib.rs Outdated Show resolved Hide resolved
@nolanxyg nolanxyg requested a review from a team January 8, 2020 10:20
@yejiayu yejiayu merged commit 3a5783e into nervosnetwork:master Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants