Skip to content

Commit

Permalink
monitor: MonitorHandle must be used
Browse files Browse the repository at this point in the history
State that events of MonitorHandle must be used,
otherwise a memory leak will occur.

Fixes #145
  • Loading branch information
surban committed Jun 26, 2024
1 parent 5e34d3e commit b2318c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bluer/src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@ impl RegisteredMonitor {
/// Use this to receive a stream of [advertisement monitor events](MonitorEvent)
/// for the registered monitor.
///
/// While a [`MonitorHandle`] is being held, its events *must* be consumed regularly.
/// Otherwise it will use an unbounded amount of memory for buffering the unconsumed events.
///
/// Drop to unregister the advertisement monitor target.
#[must_use = "the MonitorHandle must be held for the monitor to be active and its events must be consumed regularly"]
pub struct MonitorHandle {
name: dbus::Path<'static>,
event_rx: ReceiverStream<MonitorEvent>,
Expand Down

0 comments on commit b2318c6

Please sign in to comment.