Switch to fully composition based Transducers.

This commit is contained in:
Zachary Sunforge
2023-06-17 10:41:20 -07:00
parent ad66d8e030
commit 60e0edf7d2
6 changed files with 116 additions and 105 deletions

View File

@ -5,33 +5,3 @@ use crate::transducer::Stateful;
pub trait Poll<T: Copy> {
async fn poll() -> T;
}
pub struct RawStatefulInput<T: Copy> {
pub state_cell: Cell<T>,
}
impl<T: Copy> RawStatefulInput<T> {
#[inline(always)]
pub fn new(state_cell: Cell<T>) -> Self {
Self { state_cell }
}
#[inline(always)]
pub fn raw_update(&self, value: T) {
self.state_cell.set(value);
}
}
impl<T: Copy> Stateful for RawStatefulInput<T> {
type Value = T;
#[inline(always)]
fn state_cell(&self) -> CellView<Self::Value> {
(&self.state_cell).into()
}
#[inline(always)]
fn state(&self) -> Self::Value {
self.state_cell.get()
}
}