dependent_sort/dependent_sort/
arithmetic.rs

1use super::*;
2
3impl<'i, T, G> Default for DependentSort<'i, T, G> {
4    fn default() -> Self {
5        Self { tasks: vec![], allow_circular: false }
6    }
7}
8
9impl<'i, T, G> Clone for Task<'i, T, G> {
10    fn clone(&self) -> Self {
11        Self { id: self.id, group: self.group, dependent_tasks: self.dependent_tasks.clone() }
12    }
13}
14
15impl<'i, T, G> PartialEq for Task<'i, T, G>
16where
17    T: PartialEq,
18{
19    fn eq(&self, other: &Self) -> bool {
20        self.id.eq(other.id)
21    }
22}
23
24impl<'i, T, G> PartialOrd for Task<'i, T, G>
25where
26    T: PartialOrd,
27{
28    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
29        self.id.partial_cmp(other.id)
30    }
31}
32
33impl<'i, T, G> Eq for Task<'i, T, G> where T: Eq {}
34
35impl<'i, T, G> Ord for Task<'i, T, G>
36where
37    T: Ord,
38{
39    fn cmp(&self, other: &Self) -> Ordering {
40        self.id.cmp(other.id)
41    }
42}
43
44impl<'i, T, G> AddAssign<Task<'i, T, G>> for DependentSort<'i, T, G>
45where
46    T: PartialEq,
47    G: PartialEq,
48{
49    fn add_assign(&mut self, task: Task<'i, T, G>) {
50        self.tasks.push(task)
51    }
52}
53
54impl<'i, T, G> Default for FinalizeDependencies<'i, T, G> {
55    fn default() -> Self {
56        Self { task_map: vec![], group_map: vec![], virtualized_groups: vec![], virtualized_dependent_tasks: vec![] }
57    }
58}