Initial commit

This commit is contained in:
Aleksandr 2025-06-22 05:46:26 +03:00
commit 75a589f235
43 changed files with 4840 additions and 0 deletions

29
src/handling/then.rs Normal file
View file

@ -0,0 +1,29 @@
use crate::{
data,
fut::Fut,
handling::{Apply, Handler},
};
#[data(copy, ord, crate = crate)]
pub struct Then<L, R> {
pub lhs: L,
pub rhs: R,
}
impl<I, S, L, R, N, Output> Handler<I, S, N> for Then<L, R>
where
R: Send + Sync,
L: for<'a> Handler<I, S, Apply<&'a R, N>, Output = Output>,
{
type Output = Output;
fn call(&self, state: S, in_: I, next: N) -> impl Fut<Output = Self::Output> {
self.lhs.call(state, in_, Apply::new(&self.rhs, next))
}
}
impl<L, R> Then<L, R> {
pub const fn new(lhs: L, rhs: R) -> Self {
Self { lhs, rhs }
}
}