Library/Struct/Binary/
Command.rs

1/// Represents the structure for binary command execution.
2///
3/// This struct holds various fields related to the command execution, including
4/// the separator for file paths and a function to execute the command
5/// asynchronously.
6pub struct Struct {
7	/// The separator used for file paths.
8	pub Separator:Option::Separator,
9
10	/// A boxed asynchronous function that returns a pinned future.
11	pub Fn:Box<dyn Fn() -> Pin<Box<dyn Future<Output = ()> + Send + 'static>> + Send + 'static>,
12}
13
14impl Struct {
15	/// Creates a new instance of the Struct.
16	///
17	/// This function initializes the Struct with the default file path
18	/// separator and an asynchronous function that executes the command based
19	/// on the provided options. The function determines whether to execute the
20	/// command in parallel or sequentially based on the `Parallel` flag in the
21	/// options.
22	///
23	/// # Returns
24	///
25	/// Returns a new instance of Struct.
26	pub fn Fn() -> Self {
27		Self {
28			Separator:std::path::MAIN_SEPARATOR,
29
30			Fn:Box::new(|| {
31				Box::pin(async move {
32					let Option = Entry::Struct::Fn(&Option::Struct::Fn(Struct::Fn()));
33
34					match Option.Parallel {
35						true => {
36							Parallel::Fn(Option).await;
37						},
38
39						false => {
40							Sequential::Fn(Option).await;
41						},
42					};
43				})
44			}),
45		}
46	}
47}
48
49use std::pin::Pin;
50
51use futures::Future;
52
53pub mod Entry;
54
55pub mod Option;
56
57use crate::Fn::Binary::Command::{Parallel, Sequential};