1use petgraph::prelude::NodeIndex;
2
3#[derive(Default, Debug, Copy, Clone)]
4pub struct Task {
5 pub data_size: u64,
7 pub processing_density: f64,
9 pub parallel_fraction: f64,
11 pub pin: Option<NodeIndex>,
13}
14
15impl Task {
16 pub fn empty() -> Self {
17 Self::default()
18 }
19
20 pub fn with_pin(mut self, node: NodeIndex) -> Self {
21 self.pin = Some(node);
22 self
23 }
24}
25
26impl std::fmt::Display for Task {
27 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 f.write_fmt(format_args!("{:?}", self))
29 }
30}
31
32#[derive(Debug, Copy, Clone)]
33pub struct Dependency {
34 pub data_size: u64,
36}
37
38impl Dependency {
39 pub fn new(data_size: u64) -> Self {
40 Self { data_size }
41 }
42}
43
44impl std::fmt::Display for Dependency {
45 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
46 f.write_fmt(format_args!("{}b", self.data_size))
47 }
48}