You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
615 B

use super::line_separated_expressions::LineSeparatedExpressions;
use super::shell::Shell;
use std::fmt::{Debug, Write};
pub(crate) trait Expression<E: Shell>: Debug + Sized {
fn write_shell(&self, writer: &mut impl Write) -> std::fmt::Result;
fn then<B: Expression<E>>(self, other: B) -> LineSeparatedExpressions<E, Self, B> {
LineSeparatedExpressions {
_shell: std::marker::PhantomData,
a: self,
b: other,
}
}
}
impl<S: Shell> Expression<S> for () {
fn write_shell(&self, _writer: &mut impl Write) -> std::fmt::Result {
Ok(())
}
}