pub fn can_execute(&self, key: usize) -> bool {
        let this = *self.info.get(key).expect("Error: unknown key passed to TimingGroup::can_execute");
        let this_dur = Self::get_proportional(&this);
        if this_dur == self.max {
            //check if there is any task with lower time used
            if self.info.iter().any(|(_, v)| Self::get_proportional(v) != this_dur) {
                return false;
            }
        }
        // multiply max by 0.9
        let min_bound = self.max.mul_by(NonZeroU16::new(9).unwrap()).div_by(NonZeroU16::new(10).unwrap());
        //there is at least one element in slab
        let min_time = self.info.iter().map(|(_, v)| Self::get_proportional(v)).min().unwrap();
        if min_time <= min_bound { //should execute tasks that are starved
            return this_dur <= min_bound; //execute ony if below bound
        }
        //execute normally
        true
    }
/// Check if entry with specific key can be executed now.
///
/// # Panics
/// Panics if provided key has no associated entry.
Check if entry with specific key can be executed now.
Check if entry with specific key can be executed now .
pub fn can_execute(&self, key: usize) -> bool {
        let this = *self.info.get(key).expect("Error: unknown key passed to TimingGroup::can_execute");
        let this_dur = Self::get_proportional(&this);
        if this_dur == self.max {
            //check if there is any task with lower time used
            if self.info.iter().any(|(_, v)| Self::get_proportional(v) != this_dur) {
                return false;
            }
        }
        // multiply max by 0.9
        let min_bound = self.max.mul_by(NonZeroU16::new(9).unwrap()).div_by(NonZeroU16::new(10).unwrap());
        //there is at least one element in slab
        let min_time = self.info.iter().map(|(_, v)| Self::get_proportional(v)).min().unwrap();
        if min_time <= min_bound { //should execute tasks that are starved
            return this_dur <= min_bound; //execute ony if below bound
        }
        //execute normally
        true
    }
pub fn can_execute ( & self , key : usize ) -> bool { let this = * self . info . get ( key ) . expect ( " " ) ; let this_dur = Self :: get_proportional ( & this ) ; if this_dur == self . max { //check if there is any task with lower time used if self . info . iter ( ) . any ( | ( _ , v ) | Self :: get_proportional ( v ) != this_dur ) { return false ; } } // multiply max by 0.9 let min_bound = self . max . mul_by ( NonZeroU16 :: new ( 9 ) . unwrap ( ) ) . div_by ( NonZeroU16 :: new ( 10 ) . unwrap ( ) ) ; //there is at least one element in slab let min_time = self . info . iter ( ) . map ( | ( _ , v ) | Self :: get_proportional ( v ) ) . min ( ) . unwrap ( ) ; if min_time <= min_bound { //should execute tasks that are starved return this_dur <= min_bound ; //execute ony if below bound } //execute normally true }
Check if entry with specific key can be executed now.
Check if entry with specific key can be executed now .
&self
key
usize
&self
key
usize
panics
Panics if provided key has no associated entry.
Panics if provided key has no associated entry .