remove_observer

Function remove_observer 

Source
pub fn remove_observer(observer: Observer)
Expand description

Removes a previously added observer.

This function removes an observer registered with add_observer, preventing further notifications from being received.

§Arguments

§Example

use media_remote::{register_for_now_playing_notifications, add_observer, remove_observer, Notification};

register_for_now_playing_notifications();

let observer = add_observer(Notification::NowPlayingApplicationIsPlayingDidChange, || {
    println!("Now playing status changed.");
});

// Later, when no longer needed:
remove_observer(observer);