simulate-digital-rail / instant-interlocking

0 stars 0 forks source link

Setting driveway elements asynchronously #23

Open ctiedt opened 1 year ago

ctiedt commented 1 year ago

In GitLab by @ctiedt on Nov 24, 2022, 11:34

ctiedt commented 1 year ago

Currently blocked by the lack of async trait in stable Rust. We could work around this by redefining TrackElement like this:

pub trait TrackElement {
    type State: Copy + Default;

    fn id(&self) -> &str;
    fn state(&self) -> Pin<Box<dyn Future<Output = Self::State>>>;
    fn set_state(&mut self, new_state: Self::State) -> Pin<Box<dyn Future<Output = Result<(), TrackElementError>>>>;
}

but that would require a larger rewrite of both track_element and code_generation.