FactbirdHQ / mqttrust

MQTT client for embedded devices, written in rust
53 stars 5 forks source link

add release_queue() to Client and Eventloop #53

Closed andresv closed 2 years ago

andresv commented 2 years ago

This PR adds Client::release_queue() and Eventloop::release_queue(). Those can be called before dropping Client and Eventloop to get back original producer and consumer that can be given back to BBQueue after that. Useful when you want to reinit everything from scratch.

let prod = mqtt_client.release_queue().unwrap();
let cons = mqtt_eventloop.release_queue().unwrap();
mqtt_queue.try_release_framed(prod, cons);

drop(mqtt_client);
drop(mqtt_eventloop);
codecov-commenter commented 2 years ago

Codecov Report

Base: 39.16% // Head: 39.21% // Increases project coverage by +0.05% :tada:

Coverage data is based on head (fcc513e) compared to base (3f175ec). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #53 +/- ## ========================================== + Coverage 39.16% 39.21% +0.05% ========================================== Files 13 13 Lines 1177 1178 +1 Branches 338 337 -1 ========================================== + Hits 461 462 +1 Misses 568 568 Partials 148 148 ``` | [Impacted Files](https://codecov.io/gh/BlackbirdHQ/mqttrust/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ) | Coverage Δ | | |---|---|---| | [mqttrust/src/lib.rs](https://codecov.io/gh/BlackbirdHQ/mqttrust/pull/53/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ#diff-bXF0dHJ1c3Qvc3JjL2xpYi5ycw==) | `100.00% <ø> (ø)` | | | [mqttrust\_core/src/lib.rs](https://codecov.io/gh/BlackbirdHQ/mqttrust/pull/53/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ#diff-bXF0dHJ1c3RfY29yZS9zcmMvbGliLnJz) | `32.25% <ø> (ø)` | | | [mqttrust\_core/src/eventloop.rs](https://codecov.io/gh/BlackbirdHQ/mqttrust/pull/53/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ#diff-bXF0dHJ1c3RfY29yZS9zcmMvZXZlbnRsb29wLnJz) | `35.98% <100.00%> (+0.30%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlackbirdHQ)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

andresv commented 2 years ago

CI errors seems to be unrelated to my change.

andresv commented 2 years ago

Wanna merge?