mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-03 05:25:24 -04:00
The `SyncService::stop()` method could fail for the following reasons: 1. The supervisor was not properly started up, this is a programmer error. 2. The supervisor task wouldn't shut down and instead it returns a JoinError. 3. We couldn't notify the supervisor task that it should shutdown due the channel being closed. All of those cases shouldn't ever happen and the supervisor task will be stopped in all of them. 1. Since there is no supervisor to be stopped, we can safely just log an error, our tests ensure that a `SyncService::start()` does create a supervisor. 2. A JoinError can be returned if the task has been cancelled or if the supervisor task has panicked. Since we never cancel the task, nor have any panics in the supervisor task, we can assume that this won't happen. 3. The supervisor task holds on to a reference to the receiving end of the channel, as long as the task is alive the channel can not be closed. In conclusion, it doesn't seem to be useful to forward these error cases to the user.
Matrix SDK Examples
In this folder you find examples for using the matrix-sdk (and its various components) to implement specific common features, each as a separate crate. You can run each of them from the root of the repository, mind you that _ becomes - and the crate names are prefixed with example-. So to run the image bot example you can do cargo run -p example-image-bot.