iotaledger/wallet.rs

Make message interface calls consistent throughout bindings

kwek20 opened this issue · 2 comments

Most methods in the bindings go through the message interface handle.

We need to decide in which cases a special scenario can be made, requiring modified code in each binding.

Special scenarios:

  • create_handler: Setting up the connection
  • destroy_handler: tearing down specific data
  • listen: requires custom traits for closures
  • send_message: creates a unbounded_channel. Is this needed?
  • init_logger: Separate from the handler

To be changed:

  • clear_listeners

I would vote that we do everything though the message handler if possible.
This will make implementation on all bindings easier, with only a very minimal overhead (serialize, deserialize).

Those that cannot be done in this manner, will have a specific exported method, that wil call the message handler directly.
example: https://github.com/iotaledger/wallet.rs/blob/develop/bindings/java/iota-wallet-java/lib/native/src/lib.rs#L176

All bindings can access these methods, so we would not need to export them outside this class.