use std::fmt::{self, Display};
#[derive(Debug)]
pub struct Empty {
_private: (),
}
impl Empty {
pub(crate) fn new() -> Self {
Empty { _private: () }
}
}
impl Display for Empty {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
pub trait PayloadFn {
type Output;
fn call(self) -> Self::Output;
}
impl<T, R> PayloadFn for T
where
T: FnOnce() -> R,
{
type Output = R;
fn call(self) -> Self::Output {
self()
}
}
#[derive(Debug)]
pub struct Immediate<P>(pub P);
impl<P> PayloadFn for Immediate<P> {
type Output = P;
fn call(self) -> Self::Output {
self.0
}
}