hermes_tokio_runtime_components/components/
parallel.rs

1use cgp::prelude::*;
2use hermes_async_runtime_components::channel::impls::ProvideUnboundedChannelType;
3use hermes_async_runtime_components::channel_once::impls::ProvideOneShotChannelType;
4use hermes_async_runtime_components::mutex::impls::mutex::ProvideFuturesMutex;
5use hermes_async_runtime_components::stream::impls::boxed::ProvideBoxedStreamType;
6use hermes_async_runtime_components::stream::impls::map::BoxedStreamMapper;
7use hermes_async_runtime_components::subscription::impls::subscription::ProvideBoxedSubscription;
8use hermes_runtime_components::impls::os::exec_command::ExecCommandWithNoEnv;
9pub use hermes_runtime_components::traits::channel::{
10    ChannelCreatorComponent, ChannelTypeComponent, ChannelUserComponent, ReceiverStreamerComponent,
11    SenderClonerComponent,
12};
13pub use hermes_runtime_components::traits::channel_once::{
14    ChannelOnceCreatorComponent, ChannelOnceTypeComponent, ChannelOnceUserComponent,
15};
16pub use hermes_runtime_components::traits::fs::copy_file::FileCopierComponent;
17pub use hermes_runtime_components::traits::fs::create_dir::DirCreatorComponent;
18pub use hermes_runtime_components::traits::fs::file_path::FilePathTypeComponent;
19pub use hermes_runtime_components::traits::fs::read_file::FileAsStringReaderComponent;
20pub use hermes_runtime_components::traits::fs::write_file::StringToFileWriterComponent;
21pub use hermes_runtime_components::traits::mutex::MutexComponent;
22pub use hermes_runtime_components::traits::os::child_process::{
23    ChildProcessStarterComponent, ChildProcessTypeComponent, ChildProcessWaiterComponent,
24};
25pub use hermes_runtime_components::traits::os::exec_command::{
26    CommandExecutorComponent, CommandWithEnvsExecutorComponent,
27};
28pub use hermes_runtime_components::traits::os::reserve_port::TcpPortReserverComponent;
29pub use hermes_runtime_components::traits::random::RandomGeneratorComponent;
30pub use hermes_runtime_components::traits::sleep::SleeperComponent;
31pub use hermes_runtime_components::traits::spawn::TaskSpawnerComponent;
32pub use hermes_runtime_components::traits::stream::{StreamMapperComponent, StreamTypeComponent};
33pub use hermes_runtime_components::traits::subscription::SubscriptionComponent;
34pub use hermes_runtime_components::traits::task::ConcurrentTaskRunnerComponent;
35pub use hermes_runtime_components::traits::time::TimeComponent;
36
37use crate::impls::fs::copy_file::TokioCopyFile;
38use crate::impls::fs::create_dir::TokioCreateDir;
39use crate::impls::fs::file_path::ProvideStdPathType;
40use crate::impls::fs::read_file::TokioReadFileAsString;
41use crate::impls::fs::write_file::TokioWriteStringToFile;
42use crate::impls::os::child_process::{
43    ProvideTokioChildProcessType, StartTokioChildProcess, WaitChildProcess,
44};
45use crate::impls::os::exec_command::TokioExecCommand;
46use crate::impls::os::reserve_port::TokioReserveTcpPort;
47use crate::impls::parallel_task::TokioRunParallelTasks;
48use crate::impls::random::ThreadRandomGenerator;
49use crate::impls::sleep::TokioSleep;
50use crate::impls::spawn::TokioSpawnTask;
51use crate::impls::time::ProvideStdTime;
52
53define_components! {
54    TokioParallelRuntimeComponents {
55        SleeperComponent: TokioSleep,
56        TimeComponent: ProvideStdTime,
57        MutexComponent: ProvideFuturesMutex,
58        StreamTypeComponent: ProvideBoxedStreamType,
59        StreamMapperComponent: BoxedStreamMapper,
60        SubscriptionComponent: ProvideBoxedSubscription,
61        ConcurrentTaskRunnerComponent: TokioRunParallelTasks,
62        TaskSpawnerComponent: TokioSpawnTask,
63        [
64            ChannelTypeComponent,
65            ChannelCreatorComponent,
66            ChannelUserComponent,
67            ReceiverStreamerComponent,
68            SenderClonerComponent,
69        ]: ProvideUnboundedChannelType,
70        [
71            ChannelOnceTypeComponent,
72            ChannelOnceCreatorComponent,
73            ChannelOnceUserComponent,
74        ]:
75            ProvideOneShotChannelType,
76        FilePathTypeComponent: ProvideStdPathType,
77        ChildProcessTypeComponent: ProvideTokioChildProcessType,
78        ChildProcessStarterComponent: StartTokioChildProcess,
79        ChildProcessWaiterComponent: WaitChildProcess,
80        FileAsStringReaderComponent: TokioReadFileAsString,
81        DirCreatorComponent: TokioCreateDir,
82        FileCopierComponent: TokioCopyFile,
83        CommandWithEnvsExecutorComponent: TokioExecCommand,
84        CommandExecutorComponent: ExecCommandWithNoEnv,
85        StringToFileWriterComponent: TokioWriteStringToFile,
86        TcpPortReserverComponent: TokioReserveTcpPort,
87        RandomGeneratorComponent: ThreadRandomGenerator,
88    }
89}