pub struct CustomTask<T>where
T: From<i8> + Clone + Copy + Sub<Output = T> + Add<Output = T> + Display + Debug + PartialOrd + AddAssign,{ /* private fields */ }
Expand description
Represents a task a.k.a. a node in a batch graph.
Implementations§
Source§impl<T> CustomTask<T>
impl<T> CustomTask<T>
Sourcepub fn new(_id: String, _duration: T, _dependencies: Vec<String>) -> Self
pub fn new(_id: String, _duration: T, _dependencies: Vec<String>) -> Self
Examples found in repository?
examples/simple_example.rs (lines 11-15)
9fn main() {
10 let mut scheduler = Scheduler::<i32>::new();
11 scheduler.add_task(CustomTask::new(
12 "Task_A".to_string()
13 , 1
14 , vec!{}
15 ));
16 scheduler.add_task(CustomTask::new(
17 "Sidetask_B".to_string()
18 , 3
19 , vec!{"Task_A".to_string()}
20 ));
21 scheduler.add_task(CustomTask::new(
22 "Sidetask_C".to_string()
23 , 2
24 , vec!{"Task_B".to_string()}
25 ));
26 scheduler.add_task(CustomTask::new(
27 "Finish".to_string()
28 , 1
29 , vec!{"Sidetask_B".to_string(), "Sidetask_C".to_string()}
30 ));
31 match scheduler.schedule() {
32 Ok(()) => {},
33 Err(e) => {eprintln!("Error: {}", e); exit(1);},
34 }
35
36}
More examples
examples/simple_example_float.rs (lines 11-15)
9fn main() {
10 let mut scheduler = Scheduler::<f32>::new();
11 scheduler.add_task(CustomTask::new(
12 "Task_A".to_string()
13 , 1.52
14 , vec!{}
15 ));
16 scheduler.add_task(CustomTask::new(
17 "Sidetask_B".to_string()
18 , 3.25
19 , vec!{"Task_A".to_string()}
20 ));
21 scheduler.add_task(CustomTask::new(
22 "Sidetask_C".to_string()
23 , 2.0
24 , vec!{"Task_B".to_string()}
25 ));
26 scheduler.add_task(CustomTask::new(
27 "Finish".to_string()
28 , 1.25
29 , vec!{"Sidetask_B".to_string(), "Sidetask_C".to_string()}
30 ));
31 match scheduler.schedule() {
32 Ok(()) => {},
33 Err(e) => {eprintln!("Error: {}", e); exit(1);},
34 }
35
36}
pub fn get_id(&self) -> String
pub fn get_duration(&self) -> T
pub fn set_duration(&mut self, dur: T)
pub fn get_dependencies(&self) -> Vec<String>
pub fn add_dependency(&mut self, _dependency: String)
pub fn add_dependencies(&mut self, _dependencies: &mut Vec<String>)
pub fn set_dependencies(&mut self, _dependencies: Vec<String>)
pub fn get_early_start(&self) -> Option<T>
pub fn set_early_start(&mut self, es: T) -> Result<(), String>
pub fn get_early_finish(&self) -> Option<T>
pub fn set_early_finish(&mut self, ef: T) -> Result<(), String>
pub fn get_late_start(&self) -> Option<T>
pub fn set_late_start(&mut self, ls: T) -> Result<(), String>
pub fn get_late_finish(&self) -> Option<T>
pub fn set_late_finish(&mut self, lf: T) -> Result<(), String>
pub fn get_total_float(&self) -> Result<T, String>
Trait Implementations§
Source§impl<T> Clone for CustomTask<T>
impl<T> Clone for CustomTask<T>
Source§fn clone(&self) -> CustomTask<T>
fn clone(&self) -> CustomTask<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for CustomTask<T>where
T: Freeze,
impl<T> RefUnwindSafe for CustomTask<T>where
T: RefUnwindSafe,
impl<T> Send for CustomTask<T>where
T: Send,
impl<T> Sync for CustomTask<T>where
T: Sync,
impl<T> Unpin for CustomTask<T>where
T: Unpin,
impl<T> UnwindSafe for CustomTask<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more