fn try_schedule_trivial_cases(&mut self, start: T, end: T, data: Rc<D>) -> Option<T> {
        let new_node = Node::Leaf { start, end, data };

        match (self.root.take(), self.scope.take()) {
            (None, None) => {
                self.root = Some(new_node);
                self.scope = Some(start..end);
                Some(start)
            }
            (Some(root), Some(scope)) => {
                if end <= scope.start {
                    self.root = Some(Node::Intermediate {
                        left: Box::new(new_node),
                        right: Box::new(root),
                        free: end..scope.start,
                    });
                    self.scope = Some(start..scope.end);
                    Some(start)
                } else if scope.end <= start {
                    self.root = Some(Node::Intermediate {
                        left: Box::new(root),
                        right: Box::new(new_node),
                        free: scope.end..start,
                    });
                    self.scope = Some(scope.start..end);
                    Some(start)
                } else {
                    self.root = Some(root);
                    self.scope = Some(scope);
                    None
                }
            }
            _ => unreachable!(),
        }
    }
/// Common scheduling cases between all scheduling strategies. It handles the cases where
/// (a) the schedule tree is empty;
/// (b) the most optimal start and end fall completely before the left-most child in the tree
/// (c) the most optimal start and end fall completely after the right-most child in the tree
///
/// Returns the start of the scheduling if it succeeded, otherwise None
Common scheduling cases between all scheduling strategies. It handles the cases where
(a) the schedule tree is empty;
(b) the most optimal start and end fall completely before the left-most child in the tree
(c) the most optimal start and end fall completely after the right-most child in the tree

Returns the start of the scheduling if it succeeded, otherwise None
Common scheduling cases between all scheduling strategies . It handles the cases where ( a ) the schedule tree is empty ; ( b ) the most optimal start and end fall completely before the left - most child in the tree ( c ) the most optimal start and end fall completely after the right - most child in the tree Returns the start of the scheduling if it succeeded otherwise None
fn try_schedule_trivial_cases(&mut self, start: T, end: T, data: Rc<D>) -> Option<T> {
        let new_node = Node::Leaf { start, end, data };
        match (self.root.take(), self.scope.take()) {
            (None, None) => {
                self.root = Some(new_node);
                self.scope = Some(start..end);
                Some(start)
            }
            (Some(root), Some(scope)) => {
                if end <= scope.start {
                    self.root = Some(Node::Intermediate {
                        left: Box::new(new_node),
                        right: Box::new(root),
                        free: end..scope.start,
                    });
                    self.scope = Some(start..scope.end);
                    Some(start)
                } else if scope.end <= start {
                    self.root = Some(Node::Intermediate {
                        left: Box::new(root),
                        right: Box::new(new_node),
                        free: scope.end..start,
                    });
                    self.scope = Some(scope.start..end);
                    Some(start)
                } else {
                    self.root = Some(root);
                    self.scope = Some(scope);
                    None
                }
            }
            _ => unreachable!(),
        }
    }
fn try_schedule_trivial_cases ( & mut self , start : T , end : T , data : Rc < D > ) -> Option < T > { let new_node = Node :: Leaf { start , end , data } ; match ( self . root . take ( ) , self . scope . take ( ) ) { ( None , None ) => { self . root = Some ( new_node ) ; self . scope = Some ( start .. end ) ; Some ( start ) } ( Some ( root ) , Some ( scope ) ) => { if end <= scope . start { self . root = Some ( Node :: Intermediate { left : Box :: new ( new_node ) , right : Box :: new ( root ) , free : end .. scope . start , } ) ; self . scope = Some ( start .. scope . end ) ; Some ( start ) } else if scope . end <= start { self . root = Some ( Node :: Intermediate { left : Box :: new ( root ) , right : Box :: new ( new_node ) , free : scope . end .. start , } ) ; self . scope = Some ( scope . start .. end ) ; Some ( start ) } else { self . root = Some ( root ) ; self . scope = Some ( scope ) ; None } } _ => unreachable ! ( ) , } }
Common scheduling cases between all scheduling strategies.
Common scheduling cases between all scheduling strategies .
&mut self
start
T
end
T
data
Rc<D>
&mut self
start
T
end
T
data
Rc<D>