#![cfg_attr(feature = "doc-images",
cfg_attr(
all(),
doc = ::embed_doc_image::embed_image!(
"executable-command-diagram",
"src/aggregates/executable_command/executable_command.svg"
)))]
#![cfg_attr(
not(feature = "doc-images"),
doc = "**Doc images not enabled**. Compile with feature `doc-images` and \
Rust version >= 1.54 to enable."
)]
use crate::prelude::*;
use delegate::delegate;
pub mod prelude
{
pub use super::CommandExecutable;
}
pub struct CommandExecutable<E>
where
E: Executable,
{
executable: E,
}
impl<E> CommandExecutable<E>
where
E: Executable,
{
pub fn new(executable: E) -> CommandExecutable<E>
{
CommandExecutable { executable }
}
}
#[allow(clippy::inline_always)]
impl<E> Executable for CommandExecutable<E>
where
E: Executable,
{
delegate! {
to self.executable {
fn execute(&self);
}
}
}
#[allow(clippy::inline_always)]
impl<E> Command for CommandExecutable<E>
where
E: Executable,
{
delegate! {
to self.executable {
fn execute(&self);
}
}
}
impl<E> From<E> for CommandExecutable<E>
where
E: Executable,
{
fn from(executable: E) -> Self
{
CommandExecutable::new(executable)
}
}