pub fn register_notification(
        &mut self,
        event_id: fidl_avrcp::NotificationEvent,
        current: Notification,
        pos_change_interval: u32,
        responder: fidl_avrcp::TargetHandlerWatchNotificationResponder,
    ) -> Result<(), fidl::Error> {
        // If the `event_id` is not supported, reject the registration.
        if !self.get_supported_notification_events().contains(&event_id) {
            return responder.send(&mut Err(fidl_avrcp::TargetAvcError::RejectedInvalidParameter));
        }

        let data = NotificationData::new(current, pos_change_interval, responder);

        let _evicted = self
            .notifications
            .entry(event_id)
            .or_insert(BoundedQueue::new(MAX_NOTIFICATION_EVENT_QUEUE_SIZE))
            .insert(data);

        // Notify the evicted responder that the TG has removed it from the active list of responders.
        // Reply with the current value of the notification.
        // This will happen automatically, when `_evicted` is dropped.

        // Update outstanding responders with potentially new session data.
        self.update_notification_responders();

        Ok(())
    }
/// Given a notification `event_id`:
/// 1) insert it into the notifications map.
/// 2) If the queue for `event_id` is full, evict the oldest responder and respond
/// with the current value.
/// 3) Update any outstanding notification responders with any changes in state.
Given a notification `event_id`:
1) insert it into the notifications map.
2) If the queue for `event_id` is full, evict the oldest responder and respond
with the current value.
3) Update any outstanding notification responders with any changes in state.
Given a notification ` event_id ` : 1 ) insert it into the notifications map . 2 ) If the queue for ` event_id ` is full evict the oldest responder and respond with the current value . 3 ) Update any outstanding notification responders with any changes in state .
pub fn register_notification(
        &mut self,
        event_id: fidl_avrcp::NotificationEvent,
        current: Notification,
        pos_change_interval: u32,
        responder: fidl_avrcp::TargetHandlerWatchNotificationResponder,
    ) -> Result<(), fidl::Error> {
        // If the `event_id` is not supported, reject the registration.
        if !self.get_supported_notification_events().contains(&event_id) {
            return responder.send(&mut Err(fidl_avrcp::TargetAvcError::RejectedInvalidParameter));
        }
        let data = NotificationData::new(current, pos_change_interval, responder);
        let _evicted = self
            .notifications
            .entry(event_id)
            .or_insert(BoundedQueue::new(MAX_NOTIFICATION_EVENT_QUEUE_SIZE))
            .insert(data);
        // Notify the evicted responder that the TG has removed it from the active list of responders.
        // Reply with the current value of the notification.
        // This will happen automatically, when `_evicted` is dropped.
        // Update outstanding responders with potentially new session data.
        self.update_notification_responders();
        Ok(())
    }
pub fn register_notification ( & mut self , event_id : fidl_avrcp :: NotificationEvent , current : Notification , pos_change_interval : u32 , responder : fidl_avrcp :: TargetHandlerWatchNotificationResponder , ) -> Result < ( ) , fidl :: Error > { // If the `event_id` is not supported, reject the registration. if ! self . get_supported_notification_events ( ) . contains ( & event_id ) { return responder . send ( & mut Err ( fidl_avrcp :: TargetAvcError :: RejectedInvalidParameter ) ) ; } let data = NotificationData :: new ( current , pos_change_interval , responder ) ; let _evicted = self . notifications . entry ( event_id ) . or_insert ( BoundedQueue :: new ( MAX_NOTIFICATION_EVENT_QUEUE_SIZE ) ) . insert ( data ) ; // Notify the evicted responder that the TG has removed it from the active list of responders. // Reply with the current value of the notification. // This will happen automatically, when `_evicted` is dropped. // Update outstanding responders with potentially new session data. self . update_notification_responders ( ) ; Ok ( ( ) ) }
Given a notification `event_id`:
1) insert it into the notifications map.
Given a notification ` event_id ` : 1 ) insert it into the notifications map .
&mut self
event_id
fidl_avrcp::NotificationEvent
current
Notification
pos_change_interval
u32
responder
fidl_avrcp::TargetHandlerWatchNotificationResponder