On Tuesday, 14 September 2021 at 12:53:27 UTC, Adam D Ruppe wrote:
I had a problem just like this before because I was sending objects through the pipe.


This reminds my (not very successfull) attempts to implement the idea in Rust:

```rust
pub struct Edsm {
    name: String,
    pub states: Vec<State>,
    current: usize,
    //    pub state : *mut State, (?)
    pub data: *const void, // long live void* !!!
    //    pub buddy : &'a Edsm, // ... and a hell begins...
    mb: Option<Box<EventSource>>,
/* self-pipe write end fd, for sending internal events to this machine */
    mxfd: i32,

    io: Option<Box<EventSource>>,
    pub tm: Vec<EventSource>,
    sg: Vec<EventSource>,
    //    pub fs : Option<Box<EventSource>>,
// pub ecap : &'a mut Ecap, // Welcome to <'x> HELL again!!!
    ecap: *mut Ecap,
    running: bool, /* self.run() has been invoked */
}
```

When something (a struct, for ex.) goes to a queue (DList for ex.),
it is out of ANY scope and clever things like borrow checker
can not analyze it's lifetime, oops...


Reply via email to