wamp_async icon indicating copy to clipboard operation
wamp_async copied to clipboard

Consider having high-level interfaces

Open frol opened this issue 3 years ago • 4 comments

I think, we should be able to use RawValue instead of a parsed Value (see #2), and thus avoid unnecessary deserialization (see https://github.com/pandaman64/serde-query/). I would also like to have a more high-level interface to kwargs, so instead of:

async fn echo(args: Option<WampArgs>, kwargs: Option<WampKwArgs>) -> Result<(Option<WampArgs>, Option<WampKwArgs>), WampError> {
}

I would prefer to have an option to write:

async fn echo(input: MyDeserializableInputType) -> Result<MySerializableOutputType, WampError> {
}

And from the caller side instead of:

let (Some(positional_args), Some(keyword_args)) = client.call("peer.echo", args, kwargs).await?;

use:

let result = client.call("peer.echo", my_serializable_struct).await?;

frol avatar Sep 06 '20 10:09 frol