roopes_core/aggregates/executable_command/
mod.rs1#![cfg_attr(feature = "doc-images",
3 cfg_attr(
4 all(),
5 doc = ::embed_doc_image::embed_image!(
6 "executable-command-diagram",
7 "src/aggregates/executable_command/executable_command.svg"
8)))]
9#![cfg_attr(
10 not(feature = "doc-images"),
11 doc = "**Doc images not enabled**. Compile with feature `doc-images` and \
12 Rust version >= 1.54 to enable."
13)]
14use crate::prelude::*;
19use delegate::delegate;
20
21pub mod prelude
24{
25 pub use super::ExecutableCommand;
26}
27
28pub struct ExecutableCommand<C>
31where
32 C: Command,
33{
34 command: C,
35}
36
37impl<C> ExecutableCommand<C>
38where
39 C: Command,
40{
41 pub fn new(command: C) -> ExecutableCommand<C>
44 {
45 ExecutableCommand { command }
46 }
47}
48
49#[allow(clippy::inline_always)]
50impl<C> Executable for ExecutableCommand<C>
51where
52 C: Command,
53{
54 delegate! {
55 to self.command {
56 fn execute(&self);
57 }
58 }
59}
60
61#[allow(clippy::inline_always)]
62impl<C> Command for ExecutableCommand<C>
63where
64 C: Command,
65{
66 delegate! {
67 to self.command {
68 fn execute(&self);
69 }
70 }
71}
72
73impl<C> From<C> for ExecutableCommand<C>
74where
75 C: Command,
76{
77 fn from(command: C) -> Self
78 {
79 ExecutableCommand::new(command)
80 }
81}