Skip to content

Make invoke arguments a struct #173

@namesty

Description

@namesty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions