pub struct Executor<T: Default + BuildParam<P>, P: BuildCmd> {
pub configs: HashMap<String, T>,
pub outputs: HashMap<String, Vec<Task<P>>>,
/* private fields */
}
Fields§
§configs: HashMap<String, T>
§outputs: HashMap<String, Vec<Task<P>>>
Implementations§
Source§impl<T: Default + BuildParam<P>, P: BuildCmd> Executor<T, P>
impl<T: Default + BuildParam<P>, P: BuildCmd> Executor<T, P>
pub fn get_config_path(&self) -> &str
pub fn get_config_format(&self) -> &ConfigFormat
pub fn get_ns3_path(&self) -> &str
pub fn get_task_concurrent(&self) -> usize
pub fn get_retry_limit(&self) -> u32
pub fn get_configs(&self) -> &HashMap<String, T>
Sourcepub fn get_outputs(&self) -> &HashMap<String, Vec<Task<P>>>
pub fn get_outputs(&self) -> &HashMap<String, Vec<Task<P>>>
Examples found in repository?
examples/simple.rs (line 78)
64async fn main() {
65 // ========== Use toml format as the config file ==========
66 // Use ExecutorBuilder to build your executor.
67 let mut exe: Executor<MyConfig, MyParam> = ExecutorBuilder::new()
68 .config_path("config.toml")
69 .config_format(ConfigFormat::Toml)
70 .ns3_path("ns-allinone-3.33/ns-3.33/")
71 .build()
72 .unwrap();
73
74 // Run your executor.
75 let _ = exe.execute().await.unwrap();
76
77 // Collect your results.
78 let outputs = exe.get_outputs().to_owned();
79
80 // Here I just print all the results, you can do whatever you want with them here.
81 for (_, output) in outputs {
82 for task in output {
83 println!("{}", task.stderr);
84 }
85 }
86
87 // ========== Use ron format as the config file ==========
88 // Use ExecutorBuilder to build your executor.
89 let mut exe: Executor<MyConfig, MyParam> = ExecutorBuilder::new()
90 .config_path("config.ron")
91 .config_format(ConfigFormat::Ron)
92 .ns3_path("ns-allinone-3.33/ns-3.33/")
93 .task_concurrent(4)
94 .retry_limit(2)
95 .build()
96 .unwrap();
97
98 // Run your executor.
99 let _ = exe.execute().await.unwrap();
100
101 // Collect your results.
102 let outputs = exe.get_outputs().to_owned();
103
104 // Here I just print all the results, you can do whatever you want with them here.
105 for (_, output) in outputs {
106 for task in output {
107 println!("{}", task.stderr);
108 }
109 }
110}
Sourcepub async fn execute(&mut self) -> Result<(), Error>
pub async fn execute(&mut self) -> Result<(), Error>
Examples found in repository?
examples/simple.rs (line 75)
64async fn main() {
65 // ========== Use toml format as the config file ==========
66 // Use ExecutorBuilder to build your executor.
67 let mut exe: Executor<MyConfig, MyParam> = ExecutorBuilder::new()
68 .config_path("config.toml")
69 .config_format(ConfigFormat::Toml)
70 .ns3_path("ns-allinone-3.33/ns-3.33/")
71 .build()
72 .unwrap();
73
74 // Run your executor.
75 let _ = exe.execute().await.unwrap();
76
77 // Collect your results.
78 let outputs = exe.get_outputs().to_owned();
79
80 // Here I just print all the results, you can do whatever you want with them here.
81 for (_, output) in outputs {
82 for task in output {
83 println!("{}", task.stderr);
84 }
85 }
86
87 // ========== Use ron format as the config file ==========
88 // Use ExecutorBuilder to build your executor.
89 let mut exe: Executor<MyConfig, MyParam> = ExecutorBuilder::new()
90 .config_path("config.ron")
91 .config_format(ConfigFormat::Ron)
92 .ns3_path("ns-allinone-3.33/ns-3.33/")
93 .task_concurrent(4)
94 .retry_limit(2)
95 .build()
96 .unwrap();
97
98 // Run your executor.
99 let _ = exe.execute().await.unwrap();
100
101 // Collect your results.
102 let outputs = exe.get_outputs().to_owned();
103
104 // Here I just print all the results, you can do whatever you want with them here.
105 for (_, output) in outputs {
106 for task in output {
107 println!("{}", task.stderr);
108 }
109 }
110}
Trait Implementations§
Auto Trait Implementations§
impl<T, P> Freeze for Executor<T, P>
impl<T, P> RefUnwindSafe for Executor<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for Executor<T, P>
impl<T, P> Sync for Executor<T, P>
impl<T, P> Unpin for Executor<T, P>
impl<T, P> UnwindSafe for Executor<T, P>where
T: UnwindSafe,
P: 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