You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ok this might be the correct solution. I will be testing it soon: Note that fragment_handler is prefixed with mut plus we make use of the &mut prefix on each call of controlled_poll when we use the fragment handler. Note copy is also removed from the signature.
pub fn controlled_poll(
&mut self,
mut fragment_handler: impl FnMut(&AtomicBuffer, Index, Index, &Header) -> Result<ControlledPollAction, AeronError> ,
fragment_limit: i32,
) -> i32 {
let image_list = self.image_list.load_mut();
let mut fragments_read = 0;
let mut starting_index = self.round_robin_index as usize;
self.round_robin_index += 1;
if starting_index >= image_list.len() {
self.round_robin_index = 0;
starting_index = 0;
}
for i in starting_index..image_list.len() {
if fragments_read < fragment_limit {
fragments_read += image_list
.get_mut(i)
.expect("Error getting element from Image vec")
.controlled_poll(&mut fragment_handler, fragment_limit - fragments_read);
}
}
for i in 0..starting_index {
if fragments_read < fragment_limit {
fragments_read += image_list
.get_mut(i)
.expect("Error getting element from Image vec")
.controlled_poll(&mut fragment_handler, fragment_limit - fragments_read);
}
}
fragments_read
}
Signature looks like this and there should probably be () arround the (Result<ControlledPollAction, AeronError> + Copy)
pub fn controlled_poll(
&mut self,
fragment_handler: impl FnMut(&AtomicBuffer, Index, Index, &Header) -> Result<ControlledPollAction, AeronError> + Copy,
fragment_limit: i32,
) -> i32 {
The handler function can not effectively be both FnMut and Copy
The text was updated successfully, but these errors were encountered: