zbus-old icon indicating copy to clipboard operation
zbus-old copied to clipboard

Support for awaitable connection

Open zeenix opened this issue 2 years ago • 3 comments

In GitLab by @peelz on Jan 30, 2023, 19:40

It would be nice if connection errors could be reported to the caller by awaiting on the connection, e.g:

let connection = Connection::session().await?;

if let Err(err) = connection.await {
  error!("Something bad happened: {err}");
}

zeenix avatar Jan 30 '23 18:01 zeenix

I wonder if there is anything other than an error this Future impl can return. If it can only resolve to an error, that's what the output should be and not a Result.

zeenix avatar Jan 30 '23 19:01 zeenix

In GitLab by @peelz on Jan 31, 2023, 02:11

It should probably return a Result<(), ...> in case the connection were to close gracefully (see #309).

zeenix avatar Jan 31 '23 01:01 zeenix

hmm.. yeah if we go for #309, then definitely.

zeenix avatar Jan 31 '23 11:01 zeenix