Struct CustomTask

Source
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>
where T: From<i8> + Clone + Copy + Sub<Output = T> + Add<Output = T> + Display + Debug + PartialOrd + AddAssign,

Source

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
Hide additional 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}
Source

pub fn get_id(&self) -> String

Source

pub fn get_duration(&self) -> T

Source

pub fn set_duration(&mut self, dur: T)

Source

pub fn get_dependencies(&self) -> Vec<String>

Source

pub fn add_dependency(&mut self, _dependency: String)

Source

pub fn add_dependencies(&mut self, _dependencies: &mut Vec<String>)

Source

pub fn set_dependencies(&mut self, _dependencies: Vec<String>)

Source

pub fn get_early_start(&self) -> Option<T>

Source

pub fn set_early_start(&mut self, es: T) -> Result<(), String>

Source

pub fn get_early_finish(&self) -> Option<T>

Source

pub fn set_early_finish(&mut self, ef: T) -> Result<(), String>

Source

pub fn get_late_start(&self) -> Option<T>

Source

pub fn set_late_start(&mut self, ls: T) -> Result<(), String>

Source

pub fn get_late_finish(&self) -> Option<T>

Source

pub fn set_late_finish(&mut self, lf: T) -> Result<(), String>

Source

pub fn get_total_float(&self) -> Result<T, String>

Trait Implementations§

Source§

impl<T> Clone for CustomTask<T>
where T: From<i8> + Clone + Copy + Sub<Output = T> + Add<Output = T> + Display + Debug + PartialOrd + AddAssign + Clone,

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for CustomTask<T>
where T: From<i8> + Clone + Copy + Sub<Output = T> + Add<Output = T> + Display + Debug + PartialOrd + AddAssign + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.