Skip to content

Commit

Permalink
Set opts if calling subscribeMany with 1 topic
Browse files Browse the repository at this point in the history
  • Loading branch information
qm3ster committed Apr 23, 2021
1 parent 5b74f77 commit 51bf55e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/response_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ impl ResponseOptionsBuilder {

/// Sets a single set of subscribe options - for a call to subscribe_many()
pub fn subscribe_many_options(&mut self, opts: &[SubscribeOptions]) -> &mut Self {
self.data.sub_opts = Some(opts.iter().map(|opt| opt.copts).collect());
match opts {
[] => {}
// This is necessary, as the `MQTTAsync_subscribeMany` paho.mqtt.c function uses `opts` over `optlist` when `count <= 1`
[opts] => self.copts.subscribeOptions = opts.copts,
_ => self.data.sub_opts = Some(opts.iter().map(|opt| opt.copts).collect())
}
self
}

Expand Down

0 comments on commit 51bf55e

Please sign in to comment.