This commit is contained in:
parent
90ab105504
commit
b30375b14a
@ -415,7 +415,9 @@ pub mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_send_event_provider(&self, id: &ChannelId) -> Option<&SP> {
|
fn get_send_event_provider(&self, id: &ChannelId) -> Option<&SP> {
|
||||||
self.senders.get(id).filter(|sender| sender.channel_id() == *id)
|
self.senders
|
||||||
|
.get(id)
|
||||||
|
.filter(|sender| sender.channel_id() == *id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_send_event_provider(&mut self, send_provider: SP) -> bool {
|
fn add_send_event_provider(&mut self, send_provider: SP) -> bool {
|
||||||
@ -646,8 +648,14 @@ mod tests {
|
|||||||
let event_grp_1_0 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
let event_grp_1_0 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
||||||
let (event_grp_0_sender, event_grp_0_receiver) = channel();
|
let (event_grp_0_sender, event_grp_0_receiver) = channel();
|
||||||
let event_grp_0_and_1_listener = EventU32SenderMpsc::new(0, event_grp_0_sender);
|
let event_grp_0_and_1_listener = EventU32SenderMpsc::new(0, event_grp_0_sender);
|
||||||
event_man.subscribe_group(event_grp_0.group_id(), event_grp_0_and_1_listener.channel_id());
|
event_man.subscribe_group(
|
||||||
event_man.subscribe_group(event_grp_1_0.group_id(), event_grp_0_and_1_listener.channel_id());
|
event_grp_0.group_id(),
|
||||||
|
event_grp_0_and_1_listener.channel_id(),
|
||||||
|
);
|
||||||
|
event_man.subscribe_group(
|
||||||
|
event_grp_1_0.group_id(),
|
||||||
|
event_grp_0_and_1_listener.channel_id(),
|
||||||
|
);
|
||||||
event_man.add_sender(event_grp_0_and_1_listener);
|
event_man.add_sender(event_grp_0_and_1_listener);
|
||||||
|
|
||||||
event_sender
|
event_sender
|
||||||
@ -753,9 +761,15 @@ mod tests {
|
|||||||
fn test_bounded_event_sender_queue_full() {
|
fn test_bounded_event_sender_queue_full() {
|
||||||
let (event_sender, _event_receiver) = mpsc::sync_channel(3);
|
let (event_sender, _event_receiver) = mpsc::sync_channel(3);
|
||||||
let event_sender = EventU32SenderMpscBounded::new(1, event_sender, 3);
|
let event_sender = EventU32SenderMpscBounded::new(1, event_sender, 3);
|
||||||
event_sender.send_no_data(TEST_EVENT).expect("sending test event failed");
|
event_sender
|
||||||
event_sender.send_no_data(TEST_EVENT).expect("sending test event failed");
|
.send_no_data(TEST_EVENT)
|
||||||
event_sender.send_no_data(TEST_EVENT).expect("sending test event failed");
|
.expect("sending test event failed");
|
||||||
|
event_sender
|
||||||
|
.send_no_data(TEST_EVENT)
|
||||||
|
.expect("sending test event failed");
|
||||||
|
event_sender
|
||||||
|
.send_no_data(TEST_EVENT)
|
||||||
|
.expect("sending test event failed");
|
||||||
let error = event_sender.send_no_data(TEST_EVENT);
|
let error = event_sender.send_no_data(TEST_EVENT);
|
||||||
if let Err(e) = error {
|
if let Err(e) = error {
|
||||||
assert!(matches!(e, GenericSendError::QueueFull(Some(3))));
|
assert!(matches!(e, GenericSendError::QueueFull(Some(3))));
|
||||||
@ -773,6 +787,5 @@ mod tests {
|
|||||||
} else {
|
} else {
|
||||||
panic!("Expected error");
|
panic!("Expected error");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user