[][src]Function xaynet::sdk::api::run_client

#[no_mangle]pub unsafe extern "C" fn run_client(client: *mut FFIClient) -> c_int

Starts the Client and executes its tasks in an asynchronous runtime.

Errors

Ignores null pointer clients and returns an error immediately.

If the client must be stopped because of a panic or error or when the client terminates successfully, then one of the following error codes is returned:

  • -1: client didn't start due to null pointer
  • 0: no error (only for clients with finite running time)
  • 1: client panicked due to unexpected/unhandled error
  • 2: client stopped due to error ParticipantInitErr
  • 3: client stopped due to error ParticipantErr
  • 4: client stopped due to error DeserialiseErr
  • 5: client stopped due to error NetworkErr
  • 6: client stopped due to error ParseErr
  • 7: client stopped due to error GeneralErr
  • 8: client stopped due to error Fetch
  • 9: client stopped due to error PetMessage

Safety

The method dereferences from the raw pointer arguments. Therefore, the behavior of the method is undefined if the arguments don't point to valid objects.

If the client panicked (error code 1), it is the users responsibility to not access possibly invalid client state and to drop the client.