Struct ExecutorBuilder

Source
pub struct ExecutorBuilder {
    pub config_path: Option<String>,
    pub config_format: Option<ConfigFormat>,
    pub ns3_path: Option<String>,
    pub task_concurrent: Option<usize>,
    pub retry_limit: Option<u32>,
}

Fields§

§config_path: Option<String>§config_format: Option<ConfigFormat>§ns3_path: Option<String>§task_concurrent: Option<usize>§retry_limit: Option<u32>

Implementations§

Source§

impl ExecutorBuilder

Source

pub fn new() -> Self

Examples found in repository?
examples/simple.rs (line 67)
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}
Source

pub fn config_path(self, config_path: &str) -> Self

Examples found in repository?
examples/simple.rs (line 68)
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}
Source

pub fn config_format(self, config_format: ConfigFormat) -> Self

Examples found in repository?
examples/simple.rs (line 69)
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}
Source

pub fn ns3_path(self, ns3_path: &str) -> Self

Examples found in repository?
examples/simple.rs (line 70)
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}
Source

pub fn task_concurrent(self, task_concurrent: usize) -> Self

Examples found in repository?
examples/simple.rs (line 93)
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}
Source

pub fn retry_limit(self, retry_limit: u32) -> Self

Examples found in repository?
examples/simple.rs (line 94)
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}
Source

pub fn build<T: Default + BuildParam<P> + DeserializeOwned, P: BuildCmd>( self, ) -> Result<Executor<T, P>, Error>

Examples found in repository?
examples/simple.rs (line 71)
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§

Source§

impl Clone for ExecutorBuilder

Source§

fn clone(&self) -> ExecutorBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutorBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ExecutorBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.