Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make invoke arguments a struct #173

Open
namesty opened this issue Jul 13, 2023 · 0 comments
Open

Make invoke arguments a struct #173

namesty opened this issue Jul 13, 2023 · 0 comments
Milestone

Comments

@namesty
Copy link
Contributor

namesty commented Jul 13, 2023

Currently, the invoke method takes in invocation arguments as separate function arguments. Making typical invocations look like:

client.invoke(uri, method, args, None, None)

One consideration brought up by @nerfZael is to make invocation arguments a struct, ideally something similar to:

struct InvokeArgs<T: Serialize> {
  uri: Uri,
  method: String,
  args: Option<T>,
  env: Option<&[u8]>,
  resolution_context: Option<&[u8]>
}

This would enable 2 main things:

  • Having defaults:
client.invoke<R>(InvokeArgs { 
    uri: "test/hello",
    method: "sayHello",
    args: Some(MyArgs {...})
    ...Default::default()
}
  • Passing method args as a serializable struct and encode it for the user; instead of forcing the user to encode them outside and pass them as an array of u8

The case for methods with no arguments would need to be handled

@cbrzn cbrzn added this to the MVP milestone Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants